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 hash router for urls ending with a hash #4730

Merged
merged 4 commits into from
Sep 21, 2024

Conversation

birkskyum
Copy link
Member

@birkskyum birkskyum commented Sep 21, 2024

Closes #4732

I've added a test for this, and a fix which is to modify the regex that recognize the hash. The section following the hashtag should be zero/one/more chars (.*), instead of one/more chars (.+).

Result before this PR:
http://localhost:9966/test/examples/cluster.html##3/40.67/-103.59

Result after this PR:
http://localhost:9966/test/examples/cluster.html#3/40.67/-103.59

  • Confirm your changes do not include backports from Mapbox projects (unless with compliant license) - if you are not sure about this, please ask!

@birkskyum birkskyum mentioned this pull request Sep 21, 2024
1 task
@codecov-commenter
Copy link

codecov-commenter commented Sep 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.02%. Comparing base (ca4e603) to head (4ff9eaa).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4730      +/-   ##
==========================================
+ Coverage   87.75%   88.02%   +0.27%     
==========================================
  Files         247      247              
  Lines       33656    33656              
  Branches     2201     2160      -41     
==========================================
+ Hits        29536    29627      +91     
+ Misses       3132     3053      -79     
+ Partials      988      976      -12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@birkskyum birkskyum changed the title Make hash work for url's ending with hash Fix hash router for urls ending with a hash Sep 21, 2024
Copy link
Collaborator

@HarelM HarelM left a comment

Choose a reason for hiding this comment

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

It's hard to review regexp changes...
I hope this won't break previous behavior when # was not present...

@HarelM
Copy link
Collaborator

HarelM commented Sep 21, 2024

Please add a changelog item.

@birkskyum
Copy link
Member Author

birkskyum commented Sep 21, 2024

It's hard to review regexp changes... I hope this won't break previous behavior when # was not present...

All the existing tests run from a localhost/ url without a hashtag and they still pass, so that gives me some confidence nothing will break. To make sure the init behavior is as expected, I've added 5 more init tests for different url endings and a changelog

@birkskyum birkskyum merged commit 57d7d83 into maplibre:main Sep 21, 2024
15 checks passed
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.

Hash router adds second # if url ends with a #.
3 participants