chore: remove hacdias/fileutils dep (#1037)

This commit is contained in:
Henrique Dias
2020-07-18 19:10:22 +01:00
committed by GitHub
parent 2d99d0bf13
commit 0b0a704d44
3 changed files with 9 additions and 5 deletions

View File

@@ -4,16 +4,23 @@ import (
"errors"
"net/http"
"net/url"
gopath "path"
"path/filepath"
"strings"
"github.com/hacdias/fileutils"
"github.com/mholt/archiver"
"github.com/filebrowser/filebrowser/v2/files"
"github.com/filebrowser/filebrowser/v2/users"
)
func slashClean(name string) string {
if name == "" || name[0] != '/' {
name = "/" + name
}
return gopath.Clean(name)
}
func parseQueryFiles(r *http.Request, f *files.FileInfo, _ *users.User) ([]string, error) {
var fileSlice []string
names := strings.Split(r.URL.Query().Get("files"), ",")
@@ -27,7 +34,7 @@ func parseQueryFiles(r *http.Request, f *files.FileInfo, _ *users.User) ([]strin
return nil, err
}
name = fileutils.SlashClean(name)
name = slashClean(name)
fileSlice = append(fileSlice, filepath.Join(f.Path, name))
}
}