refs #14709-create-a-collection-from-selected-is-not-doing-what-it-should-do
authorPawel Kowalczyk <pawel.kowalczyk@contractors.roche.com>
Mon, 18 Feb 2019 13:33:50 +0000 (14:33 +0100)
committerPawel Kowalczyk <pawel.kowalczyk@contractors.roche.com>
Mon, 18 Feb 2019 13:33:50 +0000 (14:33 +0100)
Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk@contractors.roche.com>

src/services/collection-service/collection-service.ts
src/store/collections/collection-partial-copy-actions.ts

index 84b2cc1c9ce6eb16bd280126754acd518e44652e..f7e25541fd06bf1702abfb3513ade63359e3d6d7 100644 (file)
@@ -32,7 +32,12 @@ export class CollectionService extends TrashableResourceService<CollectionResour
 
     async deleteFiles(collectionUuid: string, filePaths: string[]) {
         for (const path of filePaths) {
-            await this.webdavClient.delete(`c=${collectionUuid}${path}`);
+            const splittedPath = path.split('/');
+            if (collectionUuid) {
+                await this.webdavClient.delete(`c=${collectionUuid}/${splittedPath[1]}`);
+            } else {
+                await this.webdavClient.delete(`c=${collectionUuid}${path}`);
+            }
         }
     }
 
@@ -54,11 +59,11 @@ export class CollectionService extends TrashableResourceService<CollectionResour
         const baseUrl = this.webdavClient.defaults.baseURL.endsWith('/')
             ? this.webdavClient.defaults.baseURL.slice(0, -1)
             : this.webdavClient.defaults.baseURL;
-            const apiToken = this.authService.getApiToken();
-            const splittedApiToken = apiToken ? apiToken.split('/') : [];
-            const userApiToken = `/t=${splittedApiToken[2]}/`;
-            const splittedPrevFileUrl = file.url.split('/');
-            const url = `${baseUrl}/${splittedPrevFileUrl[1]}${userApiToken}${splittedPrevFileUrl[2]}`;
+        const apiToken = this.authService.getApiToken();
+        const splittedApiToken = apiToken ? apiToken.split('/') : [];
+        const userApiToken = `/t=${splittedApiToken[2]}/`;
+        const splittedPrevFileUrl = file.url.split('/');
+        const url = `${baseUrl}/${splittedPrevFileUrl[1]}${userApiToken}${splittedPrevFileUrl[2]}`;
         return {
             ...file,
             url
index 2597f8d2dde6eceeed35ef669e853a3be701fa0a..9d0515abae6f037492ca72d78fe62d2be773ae12 100644 (file)
@@ -48,11 +48,11 @@ export const copyCollectionPartial = ({ name, description, projectUuid }: Collec
                 dispatch(progressIndicatorActions.START_WORKING(COLLECTION_PARTIAL_COPY_FORM_NAME));
                 const collection = await services.collectionService.get(currentCollection.uuid);
                 const collectionCopy = {
-                    ...collection,
                     name,
                     description,
                     ownerUuid: projectUuid,
-                    uuid: undefined
+                    uuid: undefined,
+                    manifestText: collection.manifestText,
                 };
                 const newCollection = await services.collectionService.create(collectionCopy);
                 const paths = filterCollectionFilesBySelection(state.collectionPanelFiles, false).map(file => file.id);