18834: fixed double path separator
authorDaniel Kutyła <daniel.kutyla@contractors.roche.com>
Wed, 6 Apr 2022 20:08:41 +0000 (22:08 +0200)
committerDaniel Kutyła <daniel.kutyla@contractors.roche.com>
Wed, 6 Apr 2022 20:08:41 +0000 (22:08 +0200)
Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła <daniel.kutyla@contractors.roche.com>

src/services/collection-service/collection-service.test.ts
src/services/collection-service/collection-service.ts

index 4aa55ef37c3deefd74f8935ebb3902e932934a11..88c5f725950f7031f9df2f7cdae0309a8cc180b2 100644 (file)
@@ -111,7 +111,7 @@ describe('collection-service', () => {
             expect(webdavClient.upload.mock.calls[0][0]).toEqual("c=zzzzz-4zz18-0123456789abcde/test-file1");
         });
 
-        it('should upload files with custom uplaod target', async () => {
+        it.only('should upload files with custom uplaod target', async () => {
             // given
             const files: File[] = [{name: 'test-file1'} as File];
             const collectionUUID = 'zzzzz-4zz18-0123456789abcde';
@@ -122,7 +122,7 @@ describe('collection-service', () => {
 
             // then
             expect(webdavClient.upload).toHaveBeenCalledTimes(1);
-            expect(webdavClient.upload.mock.calls[0][0]).toEqual("c=zzzzz-4zz18-0123456789adddd/test-path//test-file1");
+            expect(webdavClient.upload.mock.calls[0][0]).toEqual("c=zzzzz-4zz18-0123456789adddd/test-path/test-file1");
         });
     });
 
index b45ae8879246629cccceb24c9dfda1de27652e44..e5071d7e007af4ccea1f0df1ec894359ffc57618 100644 (file)
@@ -121,7 +121,7 @@ export class CollectionService extends TrashableResourceService<CollectionResour
     }
 
     private async uploadFile(collectionUuid: string, file: File, fileId: number, onProgress: UploadProgress = () => { return; }, targetLocation: string = '') {
-        const fileURL = `c=${targetLocation !== '' ? targetLocation : collectionUuid}/${file.name}`;
+        const fileURL = `c=${targetLocation !== '' ? targetLocation : collectionUuid}/${file.name}`.replace('//', '/');
         const requestConfig = {
             headers: {
                 'Content-Type': 'text/octet-stream'