lrf402788946 %!s(int64=3) %!d(string=hai) anos
pai
achega
2b22d8f60a
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      app/controller/files.js

+ 5 - 1
app/controller/files.js

@@ -140,6 +140,7 @@ class FilesController extends Controller {
   }
   }
 
 
   async serverUpload() {
   async serverUpload() {
+    console.log('in function:');
     const { ctx, app } = this;
     const { ctx, app } = this;
     const body = ctx.request.body;
     const body = ctx.request.body;
     const { name, uri, extension, code } = body;
     const { name, uri, extension, code } = body;
@@ -178,7 +179,10 @@ class FilesController extends Controller {
       throw error;
       throw error;
     }
     }
 
 
-    const returnUri = `${filePath}/${fileName}`;
+    let returnUri = `${filePath}/${fileName}`;
+    while (returnUri.indexOf('//')) {
+      returnUri = returnUri.replace('//', '/');
+    }
     this.ctx.body = this.getSuccessReturn({ uri: returnUri, id: fileName });
     this.ctx.body = this.getSuccessReturn({ uri: returnUri, id: fileName });
   }
   }