feat: some more cleaning
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
This commit is contained in:
parent
38bcc3b992
commit
85769b309e
@ -64,11 +64,6 @@ func (e *env) resourceGetHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
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 != "" {
|
if checksum := r.URL.Query().Get("checksum"); checksum != "" {
|
||||||
err = e.Checksum(file,user, checksum)
|
err = e.Checksum(file,user, checksum)
|
||||||
if err == lib.ErrInvalidOption {
|
if err == lib.ErrInvalidOption {
|
||||||
|
|||||||
@ -350,6 +350,10 @@ func (f *FileBrowser) detectType(file *File, user *User) error {
|
|||||||
file.Content = string(content)
|
file.Content = string(content)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !user.Perm.Modify && file.Type == "text" {
|
||||||
|
file.Type = "textImmutable"
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -13,8 +13,7 @@ type searchOptions struct {
|
|||||||
Terms []string
|
Terms []string
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: create filtering afero backend
|
// TODO: move to FIle Browser and also check for IsAllowed
|
||||||
// used filepath.SkipDir to skip
|
|
||||||
|
|
||||||
// Search searches for a query in a fs.
|
// 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 {
|
func Search(fs afero.Fs, scope string, query string, found func(path string, f os.FileInfo) error) error {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user