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

fix: Issue with Parameters Passed in the URL(#2124) #2139

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pietrygamat
Copy link
Contributor

@pietrygamat pietrygamat commented Apr 19, 2024

This PR fixes query parameter parsing from URL field. The '=' should be allowed within query parameter value. While first equals sign separates parameter name from its value, any subsequent occurrences are valid and should not be discarded.

fixes: #2124

Before:
Screenshot from 2024-04-19 19-33-27

After:
Screenshot from 2024-04-19 19-32-30

The '=' should be allowed within query parameter value. While first equals sign separates parameter name from its value, any subsequent occurrences are valid and should not be discarded.
let [name, value = ''] = param.split('=');
return { name, value };
});
let params = query

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it make sense to use URLSearchParams in this case that'd follow URL Standard?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The suggestion makes sense, I'll take a look. To consider here is that the URL field and query-params fields are updated based on each-other's value. That means during typing character by character, we may find ourselves in a state where the url is NOT correctly formatted (e.g. we only typed in half of the url envoded value so far), so the resulting string will not validate as URLSearchParams, and crash the view, unless handled with a fallback behavior which would be what is already in this PR anyway,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, based on discussion in #2191, there is a design decision to make, perhaps the proper fix is even more involved (like adding extra assumptions, validations and/or UI warnings).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issue with Parameters Passed in the URL
3 participants