Merge pull request #4 from berlineric/fix-downloader

fix download button doesn't work
This commit is contained in:
Erik Berlin 2024-02-12 10:23:21 +02:00 committed by GitHub
commit 8a621e05c8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 40 additions and 30 deletions

View File

@ -46,12 +46,14 @@ func previewHandler(imgSvc ImgService, fileCache FileCache, enableThumbnails, re
} }
file, err := files.NewFileInfo(files.FileOptions{ file, err := files.NewFileInfo(files.FileOptions{
Fs: d.user.Fs, Fs: d.user.Fs,
Path: "/" + vars["path"], Path: "/" + vars["path"],
Modify: d.user.Perm.Modify, Modify: d.user.Perm.Modify,
Expand: true, Expand: true,
ReadHeader: d.server.TypeDetectionByHeader, ReadHeader: d.server.TypeDetectionByHeader,
Checker: d, Checker: d,
RootPath: d.server.Root,
AnotherPath: d.server.AnotherPath,
}) })
if err != nil { if err != nil {
return errToStatus(err), err return errToStatus(err), err

View File

@ -82,12 +82,14 @@ var rawHandler = withUser(func(w http.ResponseWriter, r *http.Request, d *data)
} }
file, err := files.NewFileInfo(files.FileOptions{ file, err := files.NewFileInfo(files.FileOptions{
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: false, Expand: false,
ReadHeader: d.server.TypeDetectionByHeader, ReadHeader: d.server.TypeDetectionByHeader,
Checker: d, Checker: d,
RootPath: d.server.Root,
AnotherPath: d.server.AnotherPath,
}) })
if err != nil { if err != nil {
return errToStatus(err), err return errToStatus(err), err

View File

@ -17,12 +17,14 @@ import (
func tusPostHandler() handleFunc { func tusPostHandler() handleFunc {
return withUser(func(w http.ResponseWriter, r *http.Request, d *data) (int, error) { return withUser(func(w http.ResponseWriter, r *http.Request, d *data) (int, error) {
file, err := files.NewFileInfo(files.FileOptions{ file, err := files.NewFileInfo(files.FileOptions{
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: false, Expand: false,
ReadHeader: d.server.TypeDetectionByHeader, ReadHeader: d.server.TypeDetectionByHeader,
Checker: d, Checker: d,
RootPath: d.server.Root,
AnotherPath: d.server.AnotherPath,
}) })
switch { switch {
case errors.Is(err, afero.ErrFileNotFound): case errors.Is(err, afero.ErrFileNotFound):
@ -72,12 +74,14 @@ func tusHeadHandler() handleFunc {
} }
file, err := files.NewFileInfo(files.FileOptions{ file, err := files.NewFileInfo(files.FileOptions{
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: false, Expand: false,
ReadHeader: d.server.TypeDetectionByHeader, ReadHeader: d.server.TypeDetectionByHeader,
Checker: d, Checker: d,
RootPath: d.server.Root,
AnotherPath: d.server.AnotherPath,
}) })
if err != nil { if err != nil {
return errToStatus(err), err return errToStatus(err), err
@ -105,12 +109,14 @@ func tusPatchHandler() handleFunc {
} }
file, err := files.NewFileInfo(files.FileOptions{ file, err := files.NewFileInfo(files.FileOptions{
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: false, Expand: false,
ReadHeader: d.server.TypeDetectionByHeader, ReadHeader: d.server.TypeDetectionByHeader,
Checker: d, Checker: d,
RootPath: d.server.Root,
AnotherPath: d.server.AnotherPath,
}) })
switch { switch {