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

Sprite url gets validated before transformRequest #3897

Open
Kai-W opened this issue Mar 25, 2024 · 2 comments
Open

Sprite url gets validated before transformRequest #3897

Kai-W opened this issue Mar 25, 2024 · 2 comments
Labels
bug Something isn't working enhancement New feature or request PR is more than welcomed Extra attention is needed

Comments

@Kai-W
Copy link
Contributor

Kai-W commented Mar 25, 2024

I was experimenting with relative URLs in styles and transforming all relative URLs to absoulte ones with the transformRequst Method.
Unfortunatly the loading of Sprites failes with an invalid URL Error (because its relative) before the transformRequest Method gets called.
https://github.com/maplibre/maplibre-gl-js/blob/f6035db6670de1af2d294e3cb5f6702f8616b53f/src/style/load_sprite.ts#L31C54-L31C70

maplibre-gl-js version:
4.1.1

browser:
Chrome Version 123.0.6312.59

Steps to Trigger Behavior

  1. Load a Stylesheet with realative urls
  2. add transformRequest to transform relative to absoulte URLs
  3. Error: Unable to parse URL "/test" (url before transform)

Link to Demonstration

https://jsbin.com/ranucez/edit?html,console,output

Expected Behavior

transformRequest should be called bevor any checks if the URL is valid, eg a relative one

Actual Behavior

Error: Unable to parse URL "/maps/streets/sprite" and transformRequest never gets called for Sprites

@HarelM
Copy link
Collaborator

HarelM commented Mar 25, 2024

Feel free to submit a PR with a fix.

@HarelM HarelM added bug Something isn't working enhancement New feature or request PR is more than welcomed Extra attention is needed labels Mar 25, 2024
@HarelM
Copy link
Collaborator

HarelM commented May 6, 2024

Can you maybe share the transform request method for the relative urls?
I think the following issue describes a similar issue:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request PR is more than welcomed Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants