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 => {
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