Skip to content

Commit

Permalink
#1397: retrieving journey with %23 handled more gracefully
Browse files Browse the repository at this point in the history
  • Loading branch information
JoernBerkefeld committed Jul 8, 2024
1 parent a9c2f93 commit 4780d3f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion @types/lib/metadataTypes/Journey.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion lib/metadataTypes/Journey.js
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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
Expand Down

0 comments on commit 4780d3f

Please sign in to comment.