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

URL parser does not handle [] in the link #252

Open
celsworth opened this issue Sep 16, 2024 · 2 comments
Open

URL parser does not handle [] in the link #252

celsworth opened this issue Sep 16, 2024 · 2 comments
Assignees
Labels
bug Something isn't working P0 Critical Issue

Comments

@celsworth
Copy link

celsworth commented Sep 16, 2024

I'm having trouble generating links if the URL has [] in it, which is used in Rails to pass through arrays and hashes. For example, this, an URL like this is not parsed:

https://shalazam.info/maps/1?x=1691.0&y=755.0&zoom=5.0&pin_loc[x]=3440&pin_loc[y]=3716

I can also repreoduce this on the bbob playground with an example as simple as:

[url=https://shalazam.info?loc[x]=1]test[/url]

Parsed to:

[
  "[",
  "url=https://shalazam.info?loc",
  {
    "tag": "x",
    "attrs": {},
    "content": []
  },
  "=1]test"
]

Removing the [x] makes it work.

@JiLiZART JiLiZART self-assigned this Sep 18, 2024
@JiLiZART JiLiZART added bug Something isn't working P0 Critical Issue labels Sep 18, 2024
@fabiandecuveland
Copy link

fabiandecuveland commented Oct 11, 2024

I have hit upon a similar problem using the current version of 4.1.1. Could this be a general inability to exclude invalid tags from parsing? In my case (BBob configured for React usage), anything in brackets is converted to either an HTML tag or, depending on case a React component. The latter case even leads to runtime errors, as there is no definition for the supposed React component.

'[tag]' -> <tag>
'[Tag]' -> <Tag />

@JiLiZART
Copy link
Owner

JiLiZART commented Oct 12, 2024

@celsworth as a solution you can encode [] in url in Rails

URI::Parser.new.escape(my_url_string)

or in js

encodeURI(my_url_string)

that leads to https://shalazam.info/maps/1?x=1691.0&y=755.0&zoom=5.0&pin_loc%5Bx%5D=3440&pin_loc%5By%5D=3716

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P0 Critical Issue
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

3 participants