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

fix cleanUrl regex so that spaces in folder names arent trimmed #494

Merged
merged 1 commit into from
Mar 26, 2015

Conversation

jgravois
Copy link
Contributor

i noticed this morning that L.Util.cleanUrl incorrectly trims spaces inside url folder names.

L.esri.Util.cleanUrl('http://utility.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export Web Map Task/execute  ');
//Export Web Map Task becomes ExportWebMapTask (and induces 400 errors in requests)
>>"http://utility.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/ExportWebMapTask/execute/"

i've fixed using another regex i found on the internet.

@patrickarlt
Copy link
Contributor

@jgravois I think you could replace using 2 calls to replace with this.

url.replace(/^\s+|\s+$|\A\s+|\s+\z/g, '');

It's a little silly but it should only match whitespace at the start/end of the string/line. Here is a link to test it http://rubular.com/r/PgHbPEL6EO

jgravois added a commit that referenced this pull request Mar 26, 2015
fix cleanUrl regex so that spaces in folder names arent trimmed
@jgravois jgravois merged commit c8b3349 into Esri:master Mar 26, 2015
@jgravois
Copy link
Contributor Author

sweet. fixed, ran grunt tests and confirmed manually everything was good, rebased and merging now.

@jgravois jgravois deleted the dont-remove-url-spaces branch March 26, 2015 21:12
jgravois added a commit to jgravois/esri-leaflet that referenced this pull request Apr 23, 2022
fix cleanUrl regex so that spaces in folder names arent trimmed
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.

2 participants