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

OpenLayers zoom control icons not loading for subpages #1465

Open
jpatokal opened this issue Feb 4, 2024 · 2 comments
Open

OpenLayers zoom control icons not loading for subpages #1465

jpatokal opened this issue Feb 4, 2024 · 2 comments
Labels

Comments

@jpatokal
Copy link
Owner

jpatokal commented Feb 4, 2024

If you browse to a subpage like https://openflights.org/airport/SIN or https://openflights.org/user/jpatokal, the images for the OpenLayers controls don't load properly:

image

The paths appear to be hardcoded into js/OpenLayers.js as relative paths (img/north-mini.png etc), so it's trying to load things like https://openflights.org/airport/img/zoom-minus-mini.png and failing.

Possible solutions: we can either add redirects/rewrites to img for each of user/img, trip/img, airport/img, and airline/img, or hack the minified JS to make the paths absolute.

I spent some time trying to hack this into the nginx config, but this is not working for reasons I don't understand. Fixes or better ideas?

    location ~ \.png$ {
      rewrite "^/(.+)/img/(.+)$" /img/$2 break;
    }
@jpatokal jpatokal added the bug label Feb 4, 2024
@corywright
Copy link

Another option may be to include a base href:

<base href="https://openflights.org/">

Placing this in the <head> section of the HTML makes all relative paths resolve from the specified base URL.

@corywright
Copy link

corywright commented Jul 22, 2024

Until a solution is implemented, could simple symbolic links be added on the server for each of the img subdirectories in user, trip, airport, and airline? This would at least allow those images to appear on the site.

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

No branches or pull requests

2 participants