From 209f9fa77f751054512355f2b74b9b7258465d0b Mon Sep 17 00:00:00 2001 From: Ramires Viana <59319979+ramiresviana@users.noreply.github.com> Date: Fri, 23 Apr 2021 12:04:02 +0000 Subject: [PATCH] fix: omit file content --- files/file.go | 3 ++- http/public.go | 2 +- http/resource.go | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/files/file.go b/files/file.go index 3892d991..ad78ad06 100644 --- a/files/file.go +++ b/files/file.go @@ -50,6 +50,7 @@ type FileOptions struct { ReadHeader bool Token string Checker rules.Checker + Content bool } // NewFileInfo creates a File object from a path and a given user. This File @@ -85,7 +86,7 @@ func NewFileInfo(opts FileOptions) (*FileInfo, error) { return file, nil } - err = file.detectType(opts.Modify, true, true) + err = file.detectType(opts.Modify, opts.Content, true) if err != nil { return nil, err } diff --git a/http/public.go b/http/public.go index 26bfffb8..80bb6e2a 100644 --- a/http/public.go +++ b/http/public.go @@ -38,7 +38,7 @@ var withHashFile = func(fn handleFunc) handleFunc { Fs: d.user.Fs, Path: link.Path, Modify: d.user.Perm.Modify, - Expand: true, + Expand: false, ReadHeader: d.server.TypeDetectionByHeader, Checker: d, Token: link.Token, diff --git a/http/resource.go b/http/resource.go index 12ba126f..366d017f 100644 --- a/http/resource.go +++ b/http/resource.go @@ -27,6 +27,7 @@ var resourceGetHandler = withUser(func(w http.ResponseWriter, r *http.Request, d Expand: true, ReadHeader: d.server.TypeDetectionByHeader, Checker: d, + Content: true, }) if err != nil { return errToStatus(err), err @@ -63,7 +64,7 @@ func resourceDeleteHandler(fileCache FileCache) handleFunc { Fs: d.user.Fs, Path: r.URL.Path, Modify: d.user.Perm.Modify, - Expand: true, + Expand: false, ReadHeader: d.server.TypeDetectionByHeader, Checker: d, }) @@ -109,7 +110,7 @@ func resourcePostHandler(fileCache FileCache) handleFunc { Fs: d.user.Fs, Path: r.URL.Path, Modify: d.user.Perm.Modify, - Expand: true, + Expand: false, ReadHeader: d.server.TypeDetectionByHeader, Checker: d, })