]> BookStack Code Mirror - bookstack/blobdiff - resources/assets/js/vues/attachment-manager.js
Fixed attachment error handling, Allowed all link types
[bookstack] / resources / assets / js / vues / attachment-manager.js
index 635622b93e80dcb8a584c6d6201e52ea7f678425..16f96c70b378df6b91e5a9e63f66fc979e4988b3 100644 (file)
@@ -31,6 +31,9 @@ let methods = {
     },
 
     getFileUrl(file) {
+        if (file.external && file.path.indexOf('http') !== 0) {
+            return file.path;
+        }
         return window.baseUrl(`/attachments/${file.id}`);
     },
 
@@ -79,10 +82,8 @@ let methods = {
     },
 
     checkValidationErrors(groupName, err) {
-        console.error(err);
-        if (typeof err.response.data === "undefined" && typeof err.response.data.validation === "undefined") return;
-        this.errors[groupName] = err.response.data.validation;
-        console.log(this.errors[groupName]);
+        if (typeof err.response.data === "undefined" && typeof err.response.data === "undefined") return;
+        this.errors[groupName] = err.response.data;
     },
 
     getUploadUrl(file) {
@@ -97,6 +98,7 @@ let methods = {
 
     attachNewLink(file) {
         file.uploaded_to = this.pageId;
+        this.errors.link = {};
         this.$http.post(window.baseUrl('/attachments/link'), file).then(resp => {
             this.files.push(resp.data);
             this.file = this.newFile();