diff options
Diffstat (limited to 'pkg/api/file.go')
-rw-r--r-- | pkg/api/file.go | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/pkg/api/file.go b/pkg/api/file.go deleted file mode 100644 index e2fa8d9..0000000 --- a/pkg/api/file.go +++ /dev/null @@ -1,51 +0,0 @@ -package api - -import ( - "fmt" - "net/http" -) - -func (a *API) getFilelistHandler(w http.ResponseWriter, r *http.Request) { - pauth := r.PathValue("pauth") - if err := r.ParseForm(); err != nil { - http.Error(w, err.Error(), http.StatusBadRequest) - - return - } - form := r.PostForm - if form.Has("pauth") { - pauth = form.Get("pauth") - } - - files, err := a.idec.FilesList(pauth) - if err != nil { - http.Error(w, err.Error(), http.StatusBadRequest) - - return - } - - for _, file := range files { - fmt.Fprintf(w, "%s:%d:%s\n", file.FullName, file.Size, file.Name) - } -} - -func (a *API) getFileHandler(w http.ResponseWriter, r *http.Request) { - filename := r.PathValue("filename") - pauth := "" - if err := r.ParseForm(); err != nil { - http.Error(w, err.Error(), http.StatusBadRequest) - - return - } - form := r.PostForm - if form.Has("pauth") { - pauth = form.Get("pauth") - } - if form.Has("filename") { - filename = form.Get("filename") - } - - if err := a.idec.GetFile(pauth, filename, w); err != nil { - http.Error(w, err.Error(), http.StatusBadRequest) - } -} |