Open zerebubuth opened 9 years ago
@zerebubuth sorry about that -- do you want to roll a branch/PR for this change? I added a bunch of testcases to cover the issues we were seeing (read: Windows paths) so if your change handles those correctly then I think all that would be left to do would be to add some tests for sample hostnames that you expect to work with your changes.
https://github.com/mapbox/mapbox-studio/blob/mb-pages/test/middleware.test.js#L44-L100
Sounds good. I'll prepare a PR.
@zerebubuth @yhahn I am running into this issue as well in mapbox studio 0.2.7 OSX. I ran into this trying to use non mapbox remote sources but even using a mapbox tilejson uri fails:
http://a.tiles.mapbox.com/v3/joelsbrown1.ffb527f1.json
I realize that this is a fringe use case for mapbox studio but it would great if this worked. Is there any chance this will be fixed in a future release? Are there any workarounds for getting this to work in version 0.2.7?
In
lib/middleware.js
, the functionnormalizePaths
drops the host portion of the URI for theid
andsource
entries in the body object. This means that if your source is a remote TileJSON URI on a different host, then any attempt to save the style results in an error saying "Invalid URL".For the specific case that I am experiencing, the patch below fixes it. However, I assume
normalizePaths
was dropping the host for a reason, so perhaps this is not an appropriate fix for everyone (refs #1278), but I'd like to try and find a fix which allows us to use remote TileJSON sources.