feat: some more cleaning

License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>
This commit is contained in:
Henrique Dias 2019-01-04 09:07:53 +00:00
parent 38bcc3b992
commit 85769b309e
3 changed files with 5 additions and 7 deletions

View File

@ -64,11 +64,6 @@ func (e *env) resourceGetHandler(w http.ResponseWriter, r *http.Request) {
return
}
if !user.Perm.Modify && file.Type == "text" {
// TODO: move to detet file type
file.Type = "textImmutable"
}
if checksum := r.URL.Query().Get("checksum"); checksum != "" {
err = e.Checksum(file,user, checksum)
if err == lib.ErrInvalidOption {

View File

@ -350,6 +350,10 @@ func (f *FileBrowser) detectType(file *File, user *User) error {
file.Content = string(content)
}
if !user.Perm.Modify && file.Type == "text" {
file.Type = "textImmutable"
}
return nil
}

View File

@ -13,8 +13,7 @@ type searchOptions struct {
Terms []string
}
// TODO: create filtering afero backend
// used filepath.SkipDir to skip
// TODO: move to FIle Browser and also check for IsAllowed
// Search searches for a query in a fs.
func Search(fs afero.Fs, scope string, query string, found func(path string, f os.FileInfo) error) error {