17337: Added more tests, fixed whitespace issue
[arvados-workbench2.git] / src / services / collection-service / collection-service-files-response.ts
index c1176cd5645967c99a4af78f770268c2c2d14048..6f8b3de3a9b99bc0aac4ecb1100b95f71d6af309 100644 (file)
@@ -5,6 +5,7 @@
 import { CollectionDirectory, CollectionFile, CollectionFileType, createCollectionDirectory, createCollectionFile } from "../../models/collection-file";
 import { getTagValue } from "~/common/xml";
 import { getNodeChildren, Tree, mapTree } from '~/models/tree';
+import { escapeHashIfRequired } from "~/common/url";
 
 export const sortFilesTree = (tree: Tree<CollectionDirectory | CollectionFile>) => {
     return mapTree<CollectionDirectory | CollectionFile>(node => {
@@ -28,7 +29,7 @@ export const extractFilesData = (document: Document) => {
             const name = getTagValue(element, 'D:displayname', '');
             const size = parseInt(getTagValue(element, 'D:getcontentlength', '0'), 10);
             const url = getTagValue(element, 'D:href', '');
-            const nameSuffix = `/${encodeURIComponent(name) || ''}`;
+            const nameSuffix = `/${escapeHashIfRequired(name) || ''}`;
             const collectionUuidMatch = collectionUrlPrefix.exec(url);
             const collectionUuid = collectionUuidMatch ? collectionUuidMatch.pop() : '';
             const directory = url