mirror of
https://github.com/dutchcoders/transfer.sh.git
synced 2024-12-25 11:50:18 +01:00
commit
cd602b9256
1 changed files with 2 additions and 10 deletions
|
@ -325,6 +325,7 @@ func (s *Server) postHandler(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
}
|
||||
|
||||
filename = url.QueryEscape(filename)
|
||||
relativeURL, _ := url.Parse(path.Join(token, filename))
|
||||
fmt.Fprintln(w, getURL(r).ResolveReference(relativeURL).String())
|
||||
|
||||
|
@ -476,6 +477,7 @@ func (s *Server) putHandler(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
w.Header().Set("Content-Type", "text/plain")
|
||||
|
||||
filename = url.QueryEscape(filename)
|
||||
relativeURL, _ := url.Parse(path.Join(token, filename))
|
||||
deleteUrl, _ := url.Parse(path.Join(token, filename, metadata.DeletionToken))
|
||||
|
||||
|
@ -485,16 +487,6 @@ func (s *Server) putHandler(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
func resolveUrl(r *http.Request, u *url.URL, absolutePath bool) string {
|
||||
if u.RawQuery != "" {
|
||||
u.Path = fmt.Sprintf("%s?%s", u.Path, url.QueryEscape(u.RawQuery))
|
||||
u.RawQuery = ""
|
||||
}
|
||||
|
||||
if u.Fragment != "" {
|
||||
u.Path = fmt.Sprintf("%s#%s", u.Path, u.Fragment)
|
||||
u.Fragment = ""
|
||||
}
|
||||
|
||||
if absolutePath {
|
||||
r.URL.Path = ""
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue