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

x/tools/cmd/godoc: trailing %2F in "/pkg/foo%2F" results in invalid links. #5652

Closed
mewmew opened this issue Jun 6, 2013 · 12 comments

Comments

Projects
None yet
6 participants
@mewmew
Copy link
Contributor

commented Jun 6, 2013

What steps will reproduce the problem?
1. Run godoc -http=:3000
2. Visit http://127.0.0.1:3000/pkg/github.com%2f
3. Click on the "xgb" package (github.com/BurntSushi/xgb).

What is the expected output?
"xgb" links to http://127.0.0.1:3000/pkg/BurntSushi/xgb/ which is an invalid
link.

What do you see instead?
"xgb" should link to http://127.0.0.1:3000/pkg/github.com/BurntSushi/xgb/

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
linux

Which version are you using?  (run 'go version')
go version devel +60e04bb0d8b9 Thu Jun 06 16:30:25 2013 +1000 linux/amd64

Please provide any additional information below.
Of cause github.com%2F and BurntSushi/xgb can be replaced by an arbitrary package path.
The important part is the trailing "%2f" instead of a trailing "/"
@robpike

This comment has been minimized.

Copy link
Contributor

commented Jun 6, 2013

Comment 1:

Assigning to bradfitz because it reminds me of other discussions about URL handling.
Feel free to redirect.

Labels changed: added priority-later, removed priority-triage.

Owner changed to @bradfitz.

Status changed to Accepted.

@robpike

This comment has been minimized.

Copy link
Contributor

commented Jun 6, 2013

Comment 2:

Labels changed: added godoc.

@bradfitz

This comment has been minimized.

Copy link
Member

commented Jun 17, 2013

Comment 3:

Several possible fixes:
1a) don't navigate to a URL with %2f in it.  (how did that happen?)
1b) if we do get an HTTP request for /foo%2f, redirect to /foo/
2) make the Subdirectories Dirs list link to absolute paths (href="/pkg/net/http/")
instead of relative (href="http").

Owner changed to @griesemer.

@mewmew

This comment has been minimized.

Copy link
Contributor Author

commented Jun 20, 2013

Comment 4:

> 1a) don't navigate to a URL with %2f in it.  (how did that happen?)
I've added a bookmark in Firefox with the keyword "pkg" which navigates to
"http://golang.org/pkg/%s".
http://s21.postimg.org/moyc3urmt/keyword.png
A simple example that would trigger this behavior is typing "pkg encoding/" into the
navigation bar which Firefox would translate into "http://golang.org/pkg/encoding%2F".
A more common example would be using different variations of github.com or
code.google.com repositories were you would want to view all packages of a specific user
or all packages contained within a specific repository. (This is when running godoc
locally of cause).
While it is possible to teach yourself not to add a trailing "/" at the end of such
requests, I do think this should be resolved in godoc and not at the client.
@rsc

This comment has been minimized.

Copy link
Contributor

commented Jul 30, 2013

Comment 5:

Labels changed: added go1.2.

@adg

This comment has been minimized.

Copy link
Contributor

commented Aug 23, 2013

Comment 6:

Owner changed to ---.

@bradfitz

This comment has been minimized.

Copy link
Member

commented Sep 11, 2013

Comment 7:

Andrew, do you have a preference between 1b) and 2) above?
@rsc

This comment has been minimized.

Copy link
Contributor

commented Sep 11, 2013

Comment 8:

I think it's too late to be making changes to godoc. Let's leave this as is for Go 1.2.
If the same shortcut goes to pkg/encoding%2Fbinary we aren't going to redirect to
encoding/binary. These URLs are invalid. Let's leave it there.

Labels changed: removed go1.2.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Nov 27, 2013

Comment 9:

Labels changed: added go1.3maybe.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Dec 4, 2013

Comment 10:

Labels changed: added release-none, removed go1.3maybe.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Dec 4, 2013

Comment 11:

Labels changed: added repo-tools.

@mewmew mewmew added accepted labels Dec 4, 2013

@rsc rsc added this to the Unplanned milestone Apr 10, 2015

@rsc rsc changed the title cmd/godoc: trailing %2F in "/pkg/foo%2F" results in invalid links. x/tools/cmd/godoc: trailing %2F in "/pkg/foo%2F" results in invalid links. Apr 14, 2015

@rsc rsc removed the repo-tools label Apr 14, 2015

@mewmew

This comment has been minimized.

Copy link
Contributor Author

commented Jan 19, 2017

Close the issue for now as it has remained inactive for more than 6 months.

Anyone with more insight into the current status may re-open the issue or add a comment about the current progress.

@mewmew mewmew closed this Jan 19, 2017

@golang golang locked and limited conversation to collaborators Jan 19, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.