From 4780d3f7c8c95848558f3350d1162f132264a2c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Mon, 8 Jul 2024 15:20:14 +0200 Subject: [PATCH] #1397: retrieving journey with %23 handled more gracefully --- @types/lib/metadataTypes/Journey.d.ts.map | 2 +- lib/metadataTypes/Journey.js | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/@types/lib/metadataTypes/Journey.d.ts.map b/@types/lib/metadataTypes/Journey.d.ts.map index 184ca2330..15ab8e35c 100644 --- a/@types/lib/metadataTypes/Journey.d.ts.map +++ b/@types/lib/metadataTypes/Journey.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"Journey.d.ts","sourceRoot":"","sources":["../../../lib/metadataTypes/Journey.js"],"names":[],"mappings":";uBAUa,OAAO,wBAAwB,EAAE,QAAQ;0BACzC,OAAO,wBAAwB,EAAE,WAAW;8BAC5C,OAAO,wBAAwB,EAAE,eAAe;+BAChD,OAAO,wBAAwB,EAAE,gBAAgB;mCACjD,OAAO,wBAAwB,EAAE,oBAAoB;kCACrD,OAAO,wBAAwB,EAAE,mBAAmB;8BACpD,OAAO,wBAAwB,EAAE,eAAe;iCAChD,OAAO,wBAAwB,EAAE,kBAAkB;gCACnD,OAAO,wBAAwB,EAAE,iBAAiB;0BAClD,OAAO,wBAAwB,EAAE,WAAW;AAVzD;;;;;;;;;;;GAWG;AAEH;;;;;;;;GAQG;AACH;IACI;;;;;;;;OAQG;IACH,6BANW,MAAM,MACN,IAAI,GAAG,MAAM,EAAE,OACf,IAAI,GAAG,MAAM,EAAE,QACf,MAAM,GACJ,OAAO,CAAE,kBAAkB,CAAC,CA8HxC;IA6ED;;;;;OAKG;IACH,wBAHW,gBAAgB,gBAS1B;IAED;;;;;OAKG;IACH,wBAHW,gBAAgB,gBAK1B;IAkBD;;;;OAIG;IACH,2CAFW,eAAe,iBAmBzB;IAED;;;;;;OAMG;IACH,mCAHW,gBAAgB,GACd,gB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EH;;;;;;;;GAQG;AACH;IACI;;;;;;;;OAQG;IACH,6BANW,MAAM,MACN,IAAI,GAAG,MAAM,EAAE,OACf,IAAI,GAAG,MAAM,EAAE,QACf,MAAM,GACJ,OAAO,CAAE,kBAAkB,CAAC,CAoIxC;IA6ED;;;;;OAKG;IACH,wBAHW,gBAAgB,gBAS1B;IAED;;;;;OAKG;IACH,wBAHW,gBAAgB,gBAK1B;IAkBD;;;;OAIG;IACH,2CAFW,eAAe,iBAmBzB;IAED;;;;;;OAMG;IACH,mCAHW,gBAAgB,GACd,gBAAgB,CA2J5B;IACD;;;;;OAKG;IACH,6CAiVC;IAED;;;;;;OAMG;IACH,gCAHW,gBAAgB,GACd,OAAO,CAAE,gBAAgB,CAAC,CAiHtC;IAED;;;;;OAKG;IACH,0CAkLC;IAoDD;;;;OAIG;IACH,gCAHW,gBAAgB,GACd,OAAO,CAAE,gBAAgB,CAAC,CAuHtC;CACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBA/wCwB,mBAAmB"} \ No newline at end of file diff --git a/lib/metadataTypes/Journey.js b/lib/metadataTypes/Journey.js index 5b67689e9..0007378aa 100644 --- a/lib/metadataTypes/Journey.js +++ b/lib/metadataTypes/Journey.js @@ -49,7 +49,11 @@ class Journey extends MetadataType { let singleKey = ''; let mode = 'key'; if (key) { - if (key.startsWith('id:') || key.startsWith('%23')) { + if (key.startsWith('%23')) { + // correct the format + key = 'id:' + key.slice(3); + } + if (key.startsWith('id:')) { // ! allow selecting journeys by ID because that's what users see in the URL // if the key started with %23 assume an ID was copied from the URL but the user forgot to prefix it with id: @@ -59,6 +63,8 @@ class Journey extends MetadataType { // in the journey URL the Id is prefixed with an HTML-encoded "#" which could accidentally be copied by users // despite the slicing above, this still needs testing here because users might have prefixed the ID with id: but did not know to remove the #23 singleKey = singleKey.slice(3); + // correct the format to ensure we show sth readable in the "Downloaded" log + key = 'id:' + singleKey; } if (singleKey.includes('/')) { // in the journey URL the version is appended after the ID, separated by a forward-slash. Needs to be removed from the ID for the retrieve as we always aim to retrieve the latest version only