Fix permission of temporary files and removal of them when generating thumbnails

pull/191/merge
Aleksander Machniak 8 years ago
parent 306c901a15
commit 5a53d521c8

@ -87,7 +87,6 @@ if (!empty($_GET['_thumb']) && $attachment->is_valid()) {
if ($imgtype = $image->resize($thumbnail_size, $cache_file, true)) { if ($imgtype = $image->resize($thumbnail_size, $cache_file, true)) {
$mimetype = 'image/' . $imgtype; $mimetype = 'image/' . $imgtype;
unlink($orig_name);
} }
else { else {
// Resize failed, we need to check the file mimetype // Resize failed, we need to check the file mimetype
@ -95,6 +94,8 @@ if (!empty($_GET['_thumb']) && $attachment->is_valid()) {
$_GET['_thumb'] = 0; $_GET['_thumb'] = 0;
$_REQUEST['_embed'] = 1; $_REQUEST['_embed'] = 1;
} }
unlink($orig_name);
} }
if (!empty($_GET['_thumb'])) { if (!empty($_GET['_thumb'])) {
@ -598,6 +599,7 @@ class rcmail_attachment_handler
$this->body(0, $fp); $this->body(0, $fp);
$this->body_file = $filename; $this->body_file = $filename;
fclose($fp); fclose($fp);
@chmod(filename, 0600);
return true; return true;
} }

Loading…
Cancel
Save