IGNF / itowns-legacy

iTowns is a JS/WebGL framework for 3D geospatial data visualization
Other
53 stars 20 forks source link

Relative links in JSON data aren't interpreted relative to the JSON source but to HTML page #14

Closed tbroyer closed 8 years ago

tbroyer commented 8 years ago

This breaks the demo at http://itowns.github.io/v1demo.html which tries to load all images from http://itowns.github.io/images/... instead of http://itowns.github.io/itowns-sample-data/images/... (or http://itowns.github.io/itowns-sample-data-small/images/...).

Hopefully this is just an issue with the demo's configuration, but I suspect a bug (or actually some expectations) in the code.

For now, http://itowns.github.io/ links to the demo at https://itowns.github.io/itowns-sample-data/ to workaround the problem (where relative links work)

mbredif commented 8 years ago

One solution could be to use url.resolve(from, to) from the url npm package in order to allow the computation of absolute urls relative to the metadata json url. Is that the correct way to proceed ?

tbroyer commented 8 years ago

SGTM

vpicavet commented 8 years ago

Looks like a blocker for release. @mbredif can you implement your solution ?

mbredif commented 8 years ago

@tbroyer, could you please rebundle the itowns.js to check that http://itowns.github.io/v1demo.html now works with the fix I have just pushed? thanks

tbroyer commented 8 years ago

Done, and it indeed fixes it :raised_hands:

Also added a script to make it easy for anyone to do it (8c16c0b25ebaa668c300f7da043cab95f1b1c90e) and updated the website to use v1demo.html back.