millstone icon indicating copy to clipboard operation
millstone copied to clipboard

Enable URLs with querystring

Open rochoa opened this issue 10 years ago • 5 comments

rochoa avatar Nov 03 '14 16:11 rochoa

Great, thanks. Would appreciate a quick summary of what this fixes specifically.

springmeyer avatar Nov 03 '14 16:11 springmeyer

Sorry, I should have been more clear about what the issue was or create an issue before.

Basically this allows to use URLs like: http://i.imgur.com/yvRISk8.png?foo=bar.

rochoa avatar Nov 03 '14 16:11 rochoa

Check:

> var OLD_REGEX = /[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?/gi
undefined
> var NEW_REGEX = /[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)/gi
undefined
> 'http://i.imgur.com/yvRISk8.png?foo=bar'.match(OLD_REGEX)
[ 'http://i.imgur.com/yvRISk8.png' ]
> 'http://i.imgur.com/yvRISk8.png?foo=bar'.match(NEW_REGEX)
[ 'http://i.imgur.com/yvRISk8.png?foo=bar' ]

I don't know if it could be better to move the extract urls from carto to it's own method so we can unit test it but at the same time I don't like to expose that method in the module/public api. Maybe move it to utils.js?

rochoa avatar Nov 03 '14 23:11 rochoa

I know this is old, but I'd love to see this or something equivalent go in. In our app, all user-uploaded files are stored in an S3 bucket that's not publicly accessible. Rather than making an exception for images intended for maps, we inject presigned URLs into the CartoCSS for marker files, etc. Problem is, presigned URLs have query strings which are currently being stripped.

jchamberlain avatar Dec 08 '16 14:12 jchamberlain

I just updated the branch to solve conflicts on CHANGELOG file.

rochoa avatar Dec 09 '16 09:12 rochoa