diff options
author | Laria Carolin Chabowski <laria@laria.me> | 2020-02-15 23:26:42 +0100 |
---|---|---|
committer | Laria Carolin Chabowski <laria@laria.me> | 2020-02-15 23:26:42 +0100 |
commit | d24d5f2e21fd4bfb5c369e2932a4c62328ffa758 (patch) | |
tree | b797daa75e521954e1deae8fc9a545a4815dd47f /src/Models | |
parent | 36670080983d1484e1d659a80415957d49405ce2 (diff) | |
download | micropoly-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')
-rw-r--r-- | src/Models/Attachment.php | 3 |
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"]); |