Skip to content
This repository has been archived by the owner on Dec 3, 2018. It is now read-only.

better validation for source URLs #651

Open
jfirebaugh opened this issue Aug 12, 2014 · 4 comments
Open

better validation for source URLs #651

jfirebaugh opened this issue Aug 12, 2014 · 4 comments
Labels

Comments

@jfirebaugh
Copy link
Contributor

If you put a bad URL into the Sources dialog and click "Update", you can get some interesting/confusing behavior.

E.g. a URL which is a 200 but doesn't send TileJSON --> cryptic parse error.

Or https://a.tiles.mapbox.com/v4/jfire.hj4lo84b.json (v4 API URL without access token) --> JS error, and Mapbox Studio is de-authorized.

@tmcw tmcw added the bug label Aug 25, 2014
@rcoup
Copy link

rcoup commented Nov 26, 2014

In addition to this, valid URLs are dropped (silently) c/- the HTML5 form validation

eg. http://example.com/foo;bar=1/~bob,jim and even the fully URL-encoded version http://example.com/foo%3Bbar%3D1/~bob%2Cjim fail the pattern

I think relaxing it to something like the below would probably be okay?

<form class='js-remotedata ...
  <input class='col9' ... pattern='((([\w-]+\.[\w-]+),?)+)|(https?://[^ ]+)' ...>

rcoup added a commit to rcoup/mapbox-studio that referenced this issue Nov 26, 2014
mapbox#651 Valid URL characters are wide & varied.
@nvkelso
Copy link

nvkelso commented Oct 27, 2015

@rmarianski and I are hitting this, too, when implementing the newer API_KEY bit of tilejson for Mapzen's MVT format vector tiles in tilezen/vector-datasource#311.

In other words, loading the old (below) works fine:

http://vector.mapzen.com/osm/tilejson/mapbox.json

And loading the new (below) never loads at all in Studio 0.2.7 and Studio Classic 0.3.2 for me.

http://vector.dev.mapzen.com/osm/tilejson/mapbox.json

With the only difference being shown with the post append of ?api_key={api_key}:

http://vector.dev.mapzen.com/osm/all/{z}/{x}/{y}.mvt?api_key={api_key}

When I view the web app loading it in Chrome with http://localhost:3000/, I get the following error:

http://localhost:3000/style/15/9650/[email protected]?id=tmpstyle:///Application…p/Contents/Resources/app/node_modules/mapbox-studio-default-style&ig8uvxvg 404 (Not Found)

style?id=tmpstyle:///Applications/Mapbox Studio.app/Contents/Resources/app/node_modules/mapbox-stud…:15250

Is there a workaround now or should we hold off implementing that until #1077 lands?

@wilhelmberg
Copy link
Contributor

@nvkelso @rmarianski

Works for me (kind of):

image

Looks like a server problem on your side.

What happens, when you open one of the 404 URLs with the browser?

Most of the time I get a timeout message, that also shows in Studio for me:

image

Requesting a single tile via browser, e.g.

http://vector.dev.mapzen.com/osm/all/12/2234/1420.mvt?api_key=<MY_API_KEY>

results in this:

image

or takes ~20 to ~30 seconds to deliver the one tile:

ClientConnected: 10:53:35.514
ClientBeginRequest: 10:53:35.741
GotRequestHeaders:  10:53:35.741
ClientDoneRequest:  10:53:35.741
Determine Gateway:  0ms
DNS Lookup:         59ms
TCP/IP Connect: 61ms
HTTPS Handshake:    0ms
ServerConnected:    10:53:35.862
FiddlerBeginRequest:    10:53:35.862
ServerGotRequest:   10:53:35.863
ServerBeginResponse:    10:53:59.643
GotResponseHeaders: 10:53:59.643
ServerDoneResponse: 10:54:00.055
ClientBeginResponse:    10:54:00.056
ClientDoneResponse:  10:54:00.057

@wilhelmberg
Copy link
Contributor

@nvkelso @rmarianski
If you change the request timeout in your local Mapbox Studio Classic here you should see tiles appear.
I set it to 60000 (1 minute) and most of the tiles appear, some still timeout.

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

No branches or pull requests

5 participants