perliedman / leaflet-realtime

Put realtime data on a Leaflet map
ISC License
743 stars 167 forks source link

_bustCache function incorrectly applying query string #144

Closed JGFalkirk closed 5 years ago

JGFalkirk commented 5 years ago

_bustCache is adding the _ parameter to the GeoJSON source URL by assuming that the URL does not use any query string already. This causes any source urls using query strings to not function as intended as the query parameters are technically invalid.

Example:

Source URL when initialising Realtime is set to http://example.com/vehicles.ashx?type=Car causes requests to be made for URLs like http://example.com/vehicles.ashx?type=Car?_=123456789

The correct URL should be http://example.com/vehicles.ashx?type=Car&_=123456789

perliedman commented 5 years ago

Hi!

I can't reproduce this, and there is code in place to handle this (https://github.com/perliedman/leaflet-realtime/blob/master/src/L.Realtime.js#L284). You can for example change the URL in the example to something like https://wanderdrone.appspot.com/?foo=bar, and the URL is built correctly using & as separator between the foo and _ parameters.

Closing, but will re-open if you provide steps to reproduce.