fix: omit file content

pull/1373/head
Ramires Viana 2021-04-23 12:04:02 +00:00
parent ba8c09f454
commit 209f9fa77f
3 changed files with 6 additions and 4 deletions

View File

@ -50,6 +50,7 @@ type FileOptions struct {
ReadHeader bool ReadHeader bool
Token string Token string
Checker rules.Checker Checker rules.Checker
Content bool
} }
// NewFileInfo creates a File object from a path and a given user. This File // 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 return file, nil
} }
err = file.detectType(opts.Modify, true, true) err = file.detectType(opts.Modify, opts.Content, true)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -38,7 +38,7 @@ var withHashFile = func(fn handleFunc) handleFunc {
Fs: d.user.Fs, Fs: d.user.Fs,
Path: link.Path, Path: link.Path,
Modify: d.user.Perm.Modify, Modify: d.user.Perm.Modify,
Expand: true, Expand: false,
ReadHeader: d.server.TypeDetectionByHeader, ReadHeader: d.server.TypeDetectionByHeader,
Checker: d, Checker: d,
Token: link.Token, Token: link.Token,

View File

@ -27,6 +27,7 @@ var resourceGetHandler = withUser(func(w http.ResponseWriter, r *http.Request, d
Expand: true, Expand: true,
ReadHeader: d.server.TypeDetectionByHeader, ReadHeader: d.server.TypeDetectionByHeader,
Checker: d, Checker: d,
Content: true,
}) })
if err != nil { if err != nil {
return errToStatus(err), err return errToStatus(err), err
@ -63,7 +64,7 @@ func resourceDeleteHandler(fileCache FileCache) handleFunc {
Fs: d.user.Fs, Fs: d.user.Fs,
Path: r.URL.Path, Path: r.URL.Path,
Modify: d.user.Perm.Modify, Modify: d.user.Perm.Modify,
Expand: true, Expand: false,
ReadHeader: d.server.TypeDetectionByHeader, ReadHeader: d.server.TypeDetectionByHeader,
Checker: d, Checker: d,
}) })
@ -109,7 +110,7 @@ func resourcePostHandler(fileCache FileCache) handleFunc {
Fs: d.user.Fs, Fs: d.user.Fs,
Path: r.URL.Path, Path: r.URL.Path,
Modify: d.user.Perm.Modify, Modify: d.user.Perm.Modify,
Expand: true, Expand: false,
ReadHeader: d.server.TypeDetectionByHeader, ReadHeader: d.server.TypeDetectionByHeader,
Checker: d, Checker: d,
}) })