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

net/url Not preserving raw URL with %25 #22783

Closed
theory opened this issue Nov 17, 2017 · 3 comments
Closed

net/url Not preserving raw URL with %25 #22783

theory opened this issue Nov 17, 2017 · 3 comments

Comments

@theory
Copy link

theory commented Nov 17, 2017

Please answer these questions before submitting your issue. Thanks!

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

go version go1.9.1 darwin/amd64

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/david/dev/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/yv/h0_940zx2j38gfnkrt3xcc5c0000gn/T/go-build797957211=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"

What did you do?

I want to get at a raw URL path that contains %25. This program demonstrates the attempt.

What did you expect to see?

I would expect the output to be:

Path:    `/here%20there`
RawPath: `/here%2520there`

What did you see instead?

Instead, the output is:

Path:    `/here%20there`
RawPath: `

RawPath is not set. Should it be? Is there some other way to get back the original path with %25 preserved?

@theory
Copy link
Author

theory commented Nov 17, 2017

Ah-ha, EscapedPath() seems to return what I need. I find the various path-handling interfaces a bit confusing.

@mvdan
Copy link
Member

mvdan commented Nov 17, 2017

So there isn't an issue to be fixed here?

@theory
Copy link
Author

theory commented Nov 17, 2017

I do wish there was a way to get back the path exactly as it was in the parsed string, but using EscapedPath() solves my immediate problem. Thanks.

@golang golang locked and limited conversation to collaborators Nov 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants