fix download button doesn't work

This commit is contained in:
Erik Berlin 2024-02-12 10:22:52 +02:00
parent ee9ed022eb
commit 000bae7f4d
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{
Fs: d.user.Fs,
Path: "/" + vars["path"],
Modify: d.user.Perm.Modify,
Expand: true,
ReadHeader: d.server.TypeDetectionByHeader,
Checker: d,
Fs: d.user.Fs,
Path: "/" + vars["path"],
Modify: d.user.Perm.Modify,
Expand: true,
ReadHeader: d.server.TypeDetectionByHeader,
Checker: d,
RootPath: d.server.Root,
AnotherPath: d.server.AnotherPath,
})
if err != nil {
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{
Fs: d.user.Fs,
Path: r.URL.Path,
Modify: d.user.Perm.Modify,
Expand: false,
ReadHeader: d.server.TypeDetectionByHeader,
Checker: d,
Fs: d.user.Fs,
Path: r.URL.Path,
Modify: d.user.Perm.Modify,
Expand: false,
ReadHeader: d.server.TypeDetectionByHeader,
Checker: d,
RootPath: d.server.Root,
AnotherPath: d.server.AnotherPath,
})
if err != nil {
return errToStatus(err), err

View File

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