Rishi
Rishi

Reputation: 33

yourls shortner with multiple ampersands

I'm using a proxy to shorten url using Yourls, the proxy is calling jquery ajax method (GET) the url parameter of yourls-api.php passed is

http://localhost/webapp/default.aspx?x=499833&y=244716&resolution=1&layer=image&cc=uk

but the Yourls API is ignoring query string from second ampersand i.e the shortened url is redirecting with

http://localhost/webapp/default.aspx?x=499833

the longurl is encoded before passing it proxy.

Upvotes: 0

Views: 701

Answers (1)

Rishi
Rishi

Reputation: 33

Instead of encoding complete query string, encoding only the value of url parameter fixed the problem.

original

http://rishi.kb/yourls-api.php?signature=123456&action=shorturl&format=json&url=http://localhost/webapp/default.aspx?x=499833&y=244716&resolution=1&layer=image&cc=uk

old : http://rishi.kb/yourls-api.php?signature%3D123456%26action%3Dshorturl%26format%3Djson%26url%3Dhttp%3A%2F%2Flocalhost%2Fwebapp%2Fdefault.aspx%3Fx%3D499833%26y%3D244716%26resolution%3D1%26layer%3Dimage%26cc%3Duk

new : http://rishi.kb/yourls-api.php?signature=123456&action=shorturl&format=json&url=http%3A%2F%2Flocalhost%2Fwebapp%2Fdefault.aspx%3Fx%3D499833%26y%3D244716%26resolution%3D1%26layer%3Dimage%26cc%3Duk

Upvotes: 1

Related Questions