]> BookStack Code Mirror - bookstack/blobdiff - app/Uploads/AttachmentService.php
Reverted shift change to old migration
[bookstack] / app / Uploads / AttachmentService.php
index d530d8fbe8ab12258c1e85397ed8e2d694c0edfe..f7a0918c60930c22b5a7a565a4cafe3fbb462e37 100644 (file)
@@ -162,16 +162,17 @@ class AttachmentService
         $link = trim($requestData['link'] ?? '');
 
         if (!empty($link)) {
-            $attachment->path = $requestData['link'];
             if (!$attachment->external) {
                 $this->deleteFileInStorage($attachment);
                 $attachment->external = true;
+                $attachment->extension = '';
             }
+            $attachment->path = $requestData['link'];
         }
 
         $attachment->save();
 
-        return $attachment;
+        return $attachment->refresh();
     }
 
     /**