From: Michal Klobukowski Date: Mon, 13 Aug 2018 12:03:57 +0000 (+0200) Subject: Name hardcoded values X-Git-Tag: 1.3.0~153^2~4 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/b0462bb88a89a78a8ed2b161d8dd7562d9ca28fa Name hardcoded values Feature #13990 Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski --- diff --git a/src/services/collection-service/collection-service.ts b/src/services/collection-service/collection-service.ts index 4bb93a4a..8cf515c9 100644 --- a/src/services/collection-service/collection-service.ts +++ b/src/services/collection-service/collection-service.ts @@ -47,6 +47,7 @@ export class CollectionService extends CommonResourceService } extractFilesData(document: Document) { + const collectionUrlPrefix = /\/c=[0-9a-zA-Z\-]*/; return Array .from(document.getElementsByTagName('D:response')) .slice(1) // omit first element which is collection itself @@ -54,7 +55,10 @@ export class CollectionService extends CommonResourceService const name = getTagValue(element, 'D:displayname', ''); const size = parseInt(getTagValue(element, 'D:getcontentlength', '0'), 10); const pathname = getTagValue(element, 'D:href', ''); - const directory = pathname && pathname.replace(/\/c=[0-9a-zA-Z\-]*/, '').replace(`/${name || ''}`, ''); + const nameSuffix = `/${name || ''}`; + const directory = pathname + .replace(collectionUrlPrefix, '') + .replace(nameSuffix, ''); const href = this.webdavClient.defaults.baseURL + pathname + '?api_token=' + this.authService.getApiToken(); const data = {