Skip to content

Commit

Permalink
changed attachment deletion. fixes #66
Browse files Browse the repository at this point in the history
  • Loading branch information
geek-at committed Nov 24, 2023
1 parent 78860f3 commit 2aa433d
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions web/inc/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,12 @@ function attachmentExists($email,$id,$attachment=false)

function listAttachmentsOfMailID($email,$id)
{
$o = array();
if ($handle = opendir(getDirForEmail($email).DS.'attachments')) {
while (false !== ($entry = readdir($handle))) {
if (startsWith($entry,$id.'-')) {
$o[] = $entry;
}
}
closedir($handle);
}

return $o;
$data = json_decode(file_get_contents(getDirForEmail($email).DS.$id.'.json'),true);
$attachments = $data['parsed']['attachments'];
if(!is_array($attachments))
return [];
else
return $attachments;
}

function deleteEmail($email,$id)
Expand Down

0 comments on commit 2aa433d

Please sign in to comment.