[ARVADOS-WORKBENCH2] updated: 2.1.0-223-gbde7ca86
Git user
git at public.arvados.org
Wed Mar 24 21:51:51 UTC 2021
Summary of changes:
cypress/integration/collection.spec.js | 2 +-
src/common/url.test.ts | 30 +++++++++++++++++++---
src/common/url.ts | 4 +--
.../collection-service-files-response.ts | 3 ++-
4 files changed, 31 insertions(+), 8 deletions(-)
via bde7ca868a0c201544476da6c049a98c1188dde9 (commit)
from 3ecdcece8b6a4fd699582d6ae56def97970bdb2f (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 bde7ca868a0c201544476da6c049a98c1188dde9
Author: Daniel Kutyła <daniel.kutyla at contractors.roche.com>
Date: Wed Mar 24 22:50:56 2021 +0100
17337: Added another edge case handling
Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła <daniel.kutyla at contractors.roche.com>
diff --git a/cypress/integration/collection.spec.js b/cypress/integration/collection.spec.js
index 8c002362..6bfe5581 100644
--- a/cypress/integration/collection.spec.js
+++ b/cypress/integration/collection.spec.js
@@ -170,7 +170,7 @@ describe('Collection panel tests', function () {
})
})
- it('renames a file using valid names', function () {
+ it.only('renames a file using valid names', function () {
function eachPair(lst, func){
for(var i=0; i < lst.length - 1; i++){
func(lst[i], lst[i + 1])
diff --git a/src/common/url.test.ts b/src/common/url.test.ts
index 80181a74..b0f8ae25 100644
--- a/src/common/url.test.ts
+++ b/src/common/url.test.ts
@@ -30,11 +30,11 @@ describe('url', () => {
});
});
- describe('customEncodeURI', () => {
- it('should decode', () => {
+ describe('customDecodeURI', () => {
+ it('should decode encoded URI', () => {
// given
const path = 'test%23test%2Ftest';
- const expectedResult = 'test#test/test';
+ const expectedResult = 'test#test%2Ftest';
// when
const result = customDecodeURI(path);
@@ -42,10 +42,21 @@ describe('url', () => {
// then
expect(result).toEqual(expectedResult);
});
+
+ it('ignores non parsable URI and return its original form', () => {
+ // given
+ const path = 'test/path/with%wrong/sign';
+
+ // when
+ const result = customDecodeURI(path);
+
+ // then
+ expect(result).toEqual(path);
+ });
});
describe('customEncodeURI', () => {
- it('should encode', () => {
+ it('should encode URI', () => {
// given
const path = 'test#test/test';
const expectedResult = 'test%23test/test';
@@ -56,5 +67,16 @@ describe('url', () => {
// then
expect(result).toEqual(expectedResult);
});
+
+ it('ignores non encodable URI and return its original form', () => {
+ // given
+ const path = 22;
+
+ // when
+ const result = customEncodeURI(path as any);
+
+ // then
+ expect(result).toEqual(path);
+ });
});
});
\ No newline at end of file
diff --git a/src/common/url.ts b/src/common/url.ts
index 7a9a5158..16dc6170 100644
--- a/src/common/url.ts
+++ b/src/common/url.ts
@@ -20,7 +20,7 @@ export function normalizeURLPath(url: string) {
export const customEncodeURI = (path: string) => {
try {
- return encodeURIComponent(path).replace(/%2F/g, '/');
+ return path.split('/').map(encodeURIComponent).join('/');
} catch(e) {}
return path;
@@ -28,7 +28,7 @@ export const customEncodeURI = (path: string) => {
export const customDecodeURI = (path: string) => {
try {
- return decodeURIComponent(path.replace(/\//g, '%2F'));
+ return path.split('%2F').map(decodeURIComponent).join('%2F');
} catch(e) {}
return path;
diff --git a/src/services/collection-service/collection-service-files-response.ts b/src/services/collection-service/collection-service-files-response.ts
index 9a05fb61..9583b7a4 100644
--- a/src/services/collection-service/collection-service-files-response.ts
+++ b/src/services/collection-service/collection-service-files-response.ts
@@ -28,7 +28,8 @@ export const extractFilesData = (document: Document) => {
.map(element => {
const name = getTagValue(element, 'D:displayname', '');
const size = parseInt(getTagValue(element, 'D:getcontentlength', '0'), 10);
- const url = customDecodeURI(getTagValue(element, 'D:href', ''));
+ const href = getTagValue(element, 'D:href', '');
+ const url = customDecodeURI(href);
const nameSuffix = name;
const collectionUuidMatch = collectionUrlPrefix.exec(url);
const collectionUuid = collectionUuidMatch ? collectionUuidMatch.pop() : '';
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list