Author | SHA1 | Message | Date |
---|---|---|---|
kiska | f5c3674906 | Update 'main.go' | 3 years ago |
kiska | 1ada262b6b | Update 'main.go' | 3 years ago |
kiska | 4071d130d7 | Update 'cmd/cmd.go' | 3 years ago |
kiska | 46a543b286 | Update 'main.go' | 3 years ago |
root | dfc497ff99 | kiska test | 3 years ago |
@@ -6,7 +6,7 @@ import ( | |||||
"os" | "os" | ||||
"strings" | "strings" | ||||
"github.com/dutchcoders/transfer.sh/server" | |||||
"git.kiska.pw/kiska/transfer.sh/server" | |||||
"github.com/fatih/color" | "github.com/fatih/color" | ||||
"github.com/minio/cli" | "github.com/minio/cli" | ||||
"google.golang.org/api/googleapi" | "google.golang.org/api/googleapi" | ||||
@@ -1,6 +1,6 @@ | |||||
package main | package main | ||||
import "github.com/dutchcoders/transfer.sh/cmd" | |||||
import "git.kiska.pw/kiska/transfer.sh/cmd" | |||||
func main() { | func main() { | ||||
app := cmd.New() | app := cmd.New() | ||||
@@ -1,6 +1,6 @@ | |||||
{ | { | ||||
"dependencies": { | "dependencies": { | ||||
"github.com/dutchcoders/transfer.sh-web": { | |||||
"github.com/kiska3/transfer.sh-web": { | |||||
"branch": "master" | "branch": "master" | ||||
} | } | ||||
} | } | ||||
@@ -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)) | relativeURL, _ := url.Parse(path.Join(token, filename)) | ||||
fmt.Fprintln(w, getURL(r).ResolveReference(relativeURL).String()) | 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") | w.Header().Set("Content-Type", "text/plain") | ||||
filename = url.QueryEscape(filename) | |||||
filename = url.PathEscape(filename) | |||||
relativeURL, _ := url.Parse(path.Join(token, filename)) | relativeURL, _ := url.Parse(path.Join(token, filename)) | ||||
deleteUrl, _ := url.Parse(path.Join(token, filename, metadata.DeletionToken)) | deleteUrl, _ := url.Parse(path.Join(token, filename, metadata.DeletionToken)) | ||||
@@ -556,9 +556,10 @@ func (s *Server) CheckMetadata(token, filename string) error { | |||||
var metadata Metadata | var metadata Metadata | ||||
r, _, _, err := s.storage.Get(token, fmt.Sprintf("%s.metadata", filename)) | 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 | return err | ||||
} | } | ||||
@@ -341,7 +341,8 @@ func (s *Server) Run() { | |||||
r.HandleFunc("/{action:(?:download|get|inline)}/{token}/{filename}", s.headHandler).Methods("HEAD") | 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) { | 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 | // 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 | // from external link. If the referer url path and current path are the same it will be | ||||