Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug/1397: retrieving journey with %23 handled more gracefully #1426

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading