// SPDX-License-Identifier: AGPL-3.0
import { CollectionDirectory, CollectionFile, CollectionFileType, createCollectionDirectory, createCollectionFile } from "../../models/collection-file";
-import { getTagValue } from "~/common/xml";
-import { getNodeChildren, Tree, mapTree } from '~/models/tree';
+import { getTagValue } from "common/xml";
+import { getNodeChildren, Tree, mapTree } from 'models/tree';
export const sortFilesTree = (tree: Tree<CollectionDirectory | CollectionFile>) => {
return mapTree<CollectionDirectory | CollectionFile>(node => {
};
export const extractFilesData = (document: Document) => {
- const collectionUrlPrefix = /\/c=([^\/]*)/;
+ const collectionUrlPrefix = /\/c=([^/]*)/;
return Array
.from(document.getElementsByTagName('D:response'))
.slice(1) // omit first element which is collection itself
url,
id: [
collectionUuid ? collectionUuid : '',
- directory ? decodeURIComponent(parentPath) : '',
+ directory ? unescape(parentPath) : '',
'/' + name
].join(''),
name,
- path: decodeURIComponent(parentPath),
+ path: unescape(parentPath),
};
const result = getTagValue(element, 'D:resourcetype', '')
export const getFileFullPath = ({ name, path }: CollectionFile | CollectionDirectory) => {
return `${path}/${name}`;
-};
\ No newline at end of file
+};