Fix the handling of validation errors
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / lib / system / file / processor / AttachmentFileProcessor.class.php
index 5e954d9fd6555200971ca7f5e205296316e4f16c..a3847e976e5ef0e0209fd3a92a5c7ca4591bd69d 100644 (file)
@@ -100,8 +100,12 @@ final class AttachmentFileProcessor implements IFileProcessor
     #[\Override]
     public function canDelete(File $file): bool
     {
-        // TODO
-        return true;
+        $attachment = Attachment::findByFileID($file->fileID);
+        if ($attachment === null) {
+            return false;
+        }
+
+        return $attachment->canDelete();
     }
 
     #[\Override]