Skip to content

Commit

Permalink
Update Filespace.php
Browse files Browse the repository at this point in the history
  • Loading branch information
SourcePot committed Dec 8, 2024
1 parent 4b35935 commit 8e06068
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/php/Foundation/Filespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -592,10 +592,7 @@ private function specialFileHandling(string $file,array $entry,bool $createOnlyI
{
$debugArr=array('file'=>$file,'cntr'=>array('extractEmails'=>TRUE,'extractArchives'=>TRUE));
$entry=array_merge($debugArr['cntr'],$entry);

$this->oc['SourcePot\Datapool\Tools\MiscTools']->arr2file($entry);

if ($entry['extractEmails'] && (stripos($entry['Params']['File']['MIME-Type'],'/vnd.ms-outlook')!==FALSE || stripos($entry['Params']['File']['MIME-Type'],'/rfc822')!==FALSE || $entry['Params']['File']['Extension']=='eml' || $entry['Params']['File']['Extension']=='msg')){
if ($entry['extractEmails'] && (stripos($entry['Params']['File']['MIME-Type'],'/vnd.ms-outlook')!==FALSE || stripos($entry['Params']['File']['MIME-Type'],'/rfc822')!==FALSE || $entry['Params']['File']['Extension']=='eml' || $entry['Params']['File']['Extension']=='msg')){
$email=file_get_contents($file);
$this->email2files($email,$entry);
return TRUE;
Expand Down Expand Up @@ -632,10 +629,12 @@ public function email2files(string $email,array $entry):array
} else if ($part['header']['content-type'][0]==="text/html"){
$newEntry['Content']['Html']=$part['data'];
$this->oc['SourcePot\Datapool\Foundation\Database']->updateEntry($newEntry);
} else if (isset($part['header']['content-disposition']['filename'])){
$newEntry['fileName']=$part['header']['content-disposition']['filename'];
} else {
$contentTypeComps=explode('/',$part['header']['content-type'][0]);
$fileName=$part['header']['content-disposition']['filename']??$part['header']['content-type']['name']??'noname.'.$contentTypeComps[1];
$newEntry['fileName']=$fileName;
$newEntry['fileContent']=$part['data'];
$newEntry['Params']['File']['MIME-Type']=$part['header']['content-type'];
$newEntry['Params']['File']['MIME-Type']=$part['header']['content-type'][0];
$this->fileContent2entry($newEntry);
$statistic['files']++;
}
Expand Down

0 comments on commit 8e06068

Please sign in to comment.