[ARVADOS-WORKBENCH2] updated: 2.1.0-221-gf5f72a4e

Git user git at public.arvados.org
Tue Mar 23 22:13:06 UTC 2021


Summary of changes:
 src/common/url.test.ts                                       |  2 +-
 src/common/url.ts                                            | 12 ++++++++++--
 src/common/webdav.ts                                         |  2 +-
 src/common/xml.ts                                            |  8 +++++++-
 src/components/tree/virtual-tree.tsx                         |  1 -
 .../collection-service/collection-service-files-response.ts  |  7 +++++--
 6 files changed, 24 insertions(+), 8 deletions(-)

       via  f5f72a4ee9b00aab5492f8991677b6503a6f2ac3 (commit)
      from  ef1017fbad2ff46f5a169bb3fc7d097b5bb746f3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit f5f72a4ee9b00aab5492f8991677b6503a6f2ac3
Author: Daniel Kutyła <daniel.kutyla at contractors.roche.com>
Date:   Tue Mar 23 23:12:23 2021 +0100

    17337: Added % sign handling in collection files
    
    Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła <daniel.kutyla at contractors.roche.com>

diff --git a/src/common/url.test.ts b/src/common/url.test.ts
index 47530966..80181a74 100644
--- a/src/common/url.test.ts
+++ b/src/common/url.test.ts
@@ -48,7 +48,7 @@ describe('url', () => {
         it('should encode', () => {
             // given
             const path = 'test#test/test';
-            const expectedResult = 'test%23test%2Ftest';
+            const expectedResult = 'test%23test/test';
 
             // when
             const result = customEncodeURI(path);
diff --git a/src/common/url.ts b/src/common/url.ts
index 0d2549c1..7a9a5158 100644
--- a/src/common/url.ts
+++ b/src/common/url.ts
@@ -19,11 +19,19 @@ export function normalizeURLPath(url: string) {
 }
 
 export const customEncodeURI = (path: string) => {
-    return encodeURIComponent(path.replace(/%2F/g, '/'));
+    try {
+        return encodeURIComponent(path).replace(/%2F/g, '/');
+    } catch(e) {}
+
+    return path;
 };
 
 export const customDecodeURI = (path: string) => {
-    return decodeURIComponent(path.replace(/\//g, '%2F'));
+    try {
+        return decodeURIComponent(path.replace(/\//g, '%2F'));
+    } catch(e) {}
+
+    return path;
 };
 
 export const encodeHash = (path: string) => {
diff --git a/src/common/webdav.ts b/src/common/webdav.ts
index ca3b6d74..8d071fa6 100644
--- a/src/common/webdav.ts
+++ b/src/common/webdav.ts
@@ -79,7 +79,7 @@ export class WebDAV {
                     ? this.defaults.baseURL+'/'
                     : ''}${customEncodeURI(config.url)}`);
 
-            if (config.headers && config.headers.Destination && config.headers.Destination.indexOf('#') > -1) {
+            if (config.headers && config.headers.Destination) {
                 config.headers.Destination = encodeHash(config.headers.Destination);
             }
 
diff --git a/src/common/xml.ts b/src/common/xml.ts
index 3c6feb5d..751a327c 100644
--- a/src/common/xml.ts
+++ b/src/common/xml.ts
@@ -4,7 +4,13 @@
 
 export const getTagValue = (document: Document | Element, tagName: string, defaultValue: string) => {
     const [el] = Array.from(document.getElementsByTagName(tagName));
-    return decodeURI(el ? htmlDecode(el.innerHTML) : defaultValue);
+    const URI = el ? htmlDecode(el.innerHTML) : defaultValue;
+
+    try {
+        return decodeURI(URI);
+    } catch(e) {}
+
+    return URI;
 };
 
 const htmlDecode = (input: string) => {
diff --git a/src/components/tree/virtual-tree.tsx b/src/components/tree/virtual-tree.tsx
index 54938969..4e4500b7 100644
--- a/src/components/tree/virtual-tree.tsx
+++ b/src/components/tree/virtual-tree.tsx
@@ -182,7 +182,6 @@ export const VirtualTree = withStyles(styles)(
     class Component<T> extends React.Component<TreeProps<T> & WithStyles<CssRules>, {}> {
         render(): ReactElement<any> {
             const { items, render } = this.props;
-
             return <AutoSizer>
                 {({ height, width }) => {
                     return VirtualList(height, width, items || [], render, this.props);
diff --git a/src/services/collection-service/collection-service-files-response.ts b/src/services/collection-service/collection-service-files-response.ts
index 0dd7260b..9a05fb61 100644
--- a/src/services/collection-service/collection-service-files-response.ts
+++ b/src/services/collection-service/collection-service-files-response.ts
@@ -34,7 +34,8 @@ export const extractFilesData = (document: Document) => {
             const collectionUuid = collectionUuidMatch ? collectionUuidMatch.pop() : '';
             const directory = url
                 .replace(collectionUrlPrefix, '')
-                .replace(nameSuffix, '');
+                .replace(nameSuffix, '')
+                .replace(/\/\//g, '/');
 
             const parentPath = directory.replace(/\/$/, '');
             const data = {
@@ -48,9 +49,11 @@ export const extractFilesData = (document: Document) => {
                 path: parentPath,
             };
 
-            return getTagValue(element, 'D:resourcetype', '')
+            const result = getTagValue(element, 'D:resourcetype', '')
                 ? createCollectionDirectory(data)
                 : createCollectionFile({ ...data, size });
+
+            return result;
         });
 };
 

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list