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

parser/pageparser: enforce non-alphanumeric parameters must be quoted #13342

Closed
wants to merge 1 commit into from

Conversation

guilhas07
Copy link
Contributor

Problem:

Before unquoted named parameters would be parsed until a space was
found, allowing for non-alphanumeric parameters.

Solution:

Parse until a space, or a non-alphanumeric character is found.

Problem:
Before unquoted named parameters would be parsed until a space was
found, allowing for non-alphanumeric parameters.

Solution:
Parse until a space, or a non-alphanumeric character is found.
@jmooring
Copy link
Member

jmooring commented Feb 4, 2025

This a breaking change.

With v0.143.0 this works fine:

{{< foo param=https://example.ork/foo/?a=b&c=d#bar >}}

But with this PR:

Error: ... unrecognized character in shortcode action: U+003A ':'. Note: Parameters with non-alphanumeric args must be quoted

@jmooring
Copy link
Member

jmooring commented Feb 4, 2025

I suggest you create a topic in the forum to discuss the particular problem you are having. If it's a bug or opportunity for improvement, we'll create an issue. Please do not submit PRs without a corresponding issue that's been approved by the project lead.

@guilhas07
Copy link
Contributor Author

This a breaking change.

With v0.143.0 this works fine:

{{< foo param=https://example.ork/foo/?a=b&c=d#bar >}}

But with this PR:

Error: ... unrecognized character in shortcode action: U+003A ':'. Note: Parameters with non-alphanumeric args must be quoted

As you can see in the error, which was not added by me, Parameters with non-alphanumeric args must be quoted:

return l.errorf("unrecognized character in shortcode action: %#U. Note: Parameters with non-alphanumeric args must be quoted", r)

That is why I made this change. This makes unnamed and named parameters behaviour consistent.
This is currently not valid in v0.143.0:

{{< foo https://example.ork/foo/?a=b&c=d#bar >}}

Maybe I should have been more obvious in the pull request/commit description.

Please do not submit PRs without a corresponding issue that's been approved by the project lead.

I submitted a similar fix for this part of the code which was approved #13299 and noticed multiple PRs from non-members that didn’t seem to be associated with any approved issues so I made this honest mistake. See issue #13343

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

Successfully merging this pull request may close these issues.

2 participants