root před 2 roky
rodič
revize
dfc497ff99
3 změnil soubory, kde provedl 9 přidání a 7 odebrání
  1. +1
    -1
      manifest.json
  2. +6
    -5
      server/handlers.go
  3. +2
    -1
      server/server.go

+ 1
- 1
manifest.json Zobrazit soubor

@@ -1,6 +1,6 @@
{
"dependencies": {
"github.com/dutchcoders/transfer.sh-web": {
"github.com/kiska3/transfer.sh-web": {
"branch": "master"
}
}


+ 6
- 5
server/handlers.go Zobrazit soubor

@@ -321,7 +321,7 @@ func (s *Server) postHandler(w http.ResponseWriter, r *http.Request) {

}

filename = url.QueryEscape(filename)
filename = url.PathEscape(filename)
relativeURL, _ := url.Parse(path.Join(token, filename))
fmt.Fprintln(w, getURL(r).ResolveReference(relativeURL).String())

@@ -480,7 +480,7 @@ func (s *Server) putHandler(w http.ResponseWriter, r *http.Request) {

w.Header().Set("Content-Type", "text/plain")

filename = url.QueryEscape(filename)
filename = url.PathEscape(filename)
relativeURL, _ := url.Parse(path.Join(token, filename))
deleteUrl, _ := url.Parse(path.Join(token, filename, metadata.DeletionToken))

@@ -556,9 +556,10 @@ func (s *Server) CheckMetadata(token, filename string) error {
var metadata Metadata

r, _, _, err := s.storage.Get(token, fmt.Sprintf("%s.metadata", filename))
if s.storage.IsNotExist(err) {
return nil
} else if err != nil {
//if s.storage.IsNotExist(err) {
// return nil
//} else if err != nil {
if err != nil {
return err
}



+ 2
- 1
server/server.go Zobrazit soubor

@@ -341,7 +341,8 @@ func (s *Server) Run() {
r.HandleFunc("/{action:(?:download|get|inline)}/{token}/{filename}", s.headHandler).Methods("HEAD")

r.HandleFunc("/{token}/{filename}", s.previewHandler).MatcherFunc(func(r *http.Request, rm *mux.RouteMatch) (match bool) {
match = false
return false
match = false

// The file will show a preview page when opening the link in browser directly or
// from external link. If the referer url path and current path are the same it will be


Načítá se…
Zrušit
Uložit