From d24d5f2e21fd4bfb5c369e2932a4c62328ffa758 Mon Sep 17 00:00:00 2001 From: Laria Carolin Chabowski Date: Sat, 15 Feb 2020 23:26:42 +0100 Subject: Attachment: Only consider successfully uploaded files Previously we tried to process the file, even if it wasn't actually uploaded, resulting in errors when trying to save a note without an# attachment m( --- src/Models/Attachment.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Models/Attachment.php b/src/Models/Attachment.php index bbbd0ee..b627d33 100644 --- a/src/Models/Attachment.php +++ b/src/Models/Attachment.php @@ -200,6 +200,9 @@ class Attachment $inserts = []; foreach (self::transposeUploadsArray($uploads) as $upload) { + if ($upload["error"] !== UPLOAD_ERR_OK) + continue; + $hash = hash_file(self::HASH_ALGO, $upload["tmp_name"]); if (self::hasHash($db, $hash)) { unlink($upload["tmp_name"]); -- cgit v1.2.3-70-g09d2