瀏覽代碼

kiska test

kiska
root 3 年之前
父節點
當前提交
dfc497ff99
共有 3 個檔案被更改,包括 9 行新增7 行删除
  1. +1
    -1
      manifest.json
  2. +6
    -5
      server/handlers.go
  3. +2
    -1
      server/server.go

+ 1
- 1
manifest.json 查看文件

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


+ 6
- 5
server/handlers.go 查看文件

@@ -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 查看文件

@@ -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


Loading…
取消
儲存