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/pkgsite: responseText links in internal/frontend/fetch.go should be clickable #40306

julieqiu opened this issue Jul 20, 2020 · 4 comments


Copy link

@julieqiu julieqiu commented Jul 20, 2020

When frontend /fetch endpoint returns a response with a status 303 or 404-(but see module page), there are links in the response text that would ideally be clickable. See:

Copy link

@vikramcse vikramcse commented Jul 25, 2020

@julieqiu Before moving ahead, I want to conform about the responseText messages with clickable links
for the responseText would be

Package could not be found, but you can view module “” at <a href="" target="_blank"></a>.

and for responseText would be

<a href="" target="_blank"></a> is not a valid path.

shall I go ahead with these responseText messages? some guidelines would be helpful :)

Copy link
Contributor Author

@julieqiu julieqiu commented Jul 29, 2020

Please do, thanks @vikramcse! Some minor tweaks: is not a valid path. Were you looking for "<a href="" target="_blank"></a>"?

Package could not be found, but you can view module “” at <a href="" target="_blank"></a>.

Copy link

@vikramcse vikramcse commented Aug 4, 2020

Hi @julieqiu
I am able to run the frontend server and able to reproduce the above case.

responseText contains text with html containt (anchor tag)

below code snippet from which renders the errors

epage: &errorPage{
	messageTemplate: template.MakeTrustedTemplate(`
		<h3 class="Error-message">{{.StatusText}}</h3>
		<p class="Error-message">{{.Response}}</p>`),
	MessageData: struct{ StatusText, Response string }{http.StatusText(status), responseText},

I tried looking into the documentation of package to convert responseText into HTML
but could not find the proper method.

I also tried template.MustParseAndExecuteToHTML() which will give parsed html, but this method accepts untyped string stringConstant which is unexported.

what could be the proper method the parse above text?

@gopherbot gopherbot added the label Sep 18, 2020
@julieqiu julieqiu removed the label Sep 19, 2020
Copy link

@gopherbot gopherbot commented Dec 11, 2020

Change mentions this issue: internal/frontend: Make links on 404 => Request page clickable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants