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

allow for multiple osm_tags #21

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

allow for multiple osm_tags #21

wants to merge 3 commits into from

Conversation

ghost
Copy link

@ghost ghost commented May 31, 2018

update buildQueryString() to accept array values. This allows for passing an array of osm_tag values and having them all passed to the photon server correctly.

calling encodeURIComponent on osm_tag(s) breaks place:city

intergalacticdata added 3 commits May 30, 2018 19:21
verifies that non-strings have a length > 0. removes string encoding - osm_tag place:value combos are currently broken due to encoding the colon.
@yohanboniface
Copy link
Collaborator

Thanks for this work!
The array support seems legit, but I've some comments.

calling encodeURIComponent on osm_tag(s) breaks place:city

: is not valid as query string key, afaik: https://tools.ietf.org/html/rfc3986#section-2.2

@@ -372,7 +376,7 @@ L.PhotonSearch = L.PhotonBaseSearch.extend({
},

_onSelected: function (feature) {
this.map.setView([feature.geometry.coordinates[1], feature.geometry.coordinates[0]], 16);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change seems unrelated to the current topic.

if (params[key]) {
queryString.push(encodeURIComponent(key) + '=' + encodeURIComponent(params[key]));
if (params[key] && (typeof(params[key]) == 'string' || typeof(params[key]) == 'number')) {
queryString.push(encodeURIComponent(key) + '=' + params[key]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should be factorized with the line 38.
Basically I think the pattern is to always process an array, and turn the param in an array when it's not.

@ghost
Copy link
Author

ghost commented Jun 6, 2018 via email

@ghost
Copy link
Author

ghost commented Jun 6, 2018 via email

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

Successfully merging this pull request may close these issues.

1 participant