ISSUE-164 (#166)

This commit is contained in:
Andrea Spacca
2018-10-19 22:37:23 +02:00
committed by GitHub
parent b8da8ff855
commit 60c1c1a116

View File

@ -95,7 +95,6 @@ func healthHandler(w http.ResponseWriter, r *http.Request) {
/* The preview handler will show a preview of the content for browsers (accept type text/html), and referer is not transfer.sh */ /* The preview handler will show a preview of the content for browsers (accept type text/html), and referer is not transfer.sh */
func (s *Server) previewHandler(w http.ResponseWriter, r *http.Request) { func (s *Server) previewHandler(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r) vars := mux.Vars(r)
token := vars["token"] token := vars["token"]
@ -151,8 +150,9 @@ func (s *Server) previewHandler(w http.ResponseWriter, r *http.Request) {
return return
} }
resolvedUrl := resolveUrl(r, getURL(r).ResolveReference(r.URL), true)
var png []byte var png []byte
png, err = qrcode.Encode(resolveUrl(r, getURL(r).ResolveReference(r.URL), true), qrcode.High, 150) png, err = qrcode.Encode(resolvedUrl, qrcode.High, 150)
if err != nil { if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError) http.Error(w, err.Error(), http.StatusInternalServerError)
return return
@ -173,7 +173,7 @@ func (s *Server) previewHandler(w http.ResponseWriter, r *http.Request) {
contentType, contentType,
content, content,
filename, filename,
r.URL.String(), resolvedUrl,
contentLength, contentLength,
s.gaKey, s.gaKey,
s.userVoiceKey, s.userVoiceKey,