aboutsummaryrefslogtreecommitdiff
path: root/src/Models/Attachment.php
diff options
context:
space:
mode:
authorLaria Carolin Chabowski <laria@laria.me>2020-02-15 23:26:42 +0100
committerLaria Carolin Chabowski <laria@laria.me>2020-02-15 23:26:42 +0100
commitd24d5f2e21fd4bfb5c369e2932a4c62328ffa758 (patch)
treeb797daa75e521954e1deae8fc9a545a4815dd47f /src/Models/Attachment.php
parent36670080983d1484e1d659a80415957d49405ce2 (diff)
downloadmicropoly-d24d5f2e21fd4bfb5c369e2932a4c62328ffa758.tar.gz
micropoly-d24d5f2e21fd4bfb5c369e2932a4c62328ffa758.tar.bz2
micropoly-d24d5f2e21fd4bfb5c369e2932a4c62328ffa758.zip
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(
Diffstat (limited to 'src/Models/Attachment.php')
-rw-r--r--src/Models/Attachment.php3
1 files changed, 3 insertions, 0 deletions
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"]);