Skip to content

net/url: URL.String() on Chrome intent URLs with an embedded "https://" string inside of a Fragment is not being encoded properly #13784

@hasSoumya

Description

@hasSoumya

What version of Go are you using (go version)?
1.5.1

What operating system and processor architecture are you using?
Mac OS X El Capitan (Darwin Kernel Version 15.0.0)

What did you do?
See : http://play.golang.org/p/oNl2dEgd9L

What did you expect to see?
intent://path/?query=test#Intent;scheme=something;package=app.mozilla.firefox;S.query=test;S.browser_fallback_url=https%3A%2F%2Fbooyah.com%2Fmy.apk;end

What did you see instead?
intent://path/?query=test#Intent;scheme=something;package=app.mozilla.firefox;S.query=test;S.browser_fallback_url=https%253A%252F%252Fbooyah.com%252Fmy.apk;end

Details:

Note: The Chrome spec here is purely an example on which I was working on

The intention is to produce something like the following based on Chromes specification about fallback URLs: https://developer.chrome.com/multidevice/android/intents

Ref: http://play.golang.org/p/oNl2dEgd9L

Expected URL: intent://path/?query=test#Intent;scheme=something;package=app.mozilla.firefox;S.query=test;S.browser_fallback_url=https%3A%2F%2Fbooyah.com%2Fmy.apk;end

When I use the library somewhat properly embedding the https:// link inside of the URL Fragment, it looks like the following URL: intent://path/?query=test#Intent;scheme=something;package=app.mozilla.firefox;S.query=test;S.browser_fallback_url=https%253A%252F%252Fbooyah.com%252Fmy.apk;end

I might be missing something, but increasingly it looks like some sort of bug just eyeballing the escape() function inside the url library. Note the spurious %25 being added onto the https:// url. Even when I don't encode the embedded https:// - String() does not encode the url at all and leaves it bare like so:
intent://path/?query=test#Intent;scheme=something;package=app.mozilla.firefox;S.query=test;S.browser_fallback_url=https://booyah.com/my.apk;end

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions