diff options
Diffstat (limited to 'pkg/view')
-rw-r--r-- | pkg/view/filesystem.go | 11 | ||||
-rw-r--r-- | pkg/view/media.go | 4 |
2 files changed, 9 insertions, 6 deletions
diff --git a/pkg/view/filesystem.go b/pkg/view/filesystem.go index d598b88..7fd7331 100644 --- a/pkg/view/filesystem.go +++ b/pkg/view/filesystem.go @@ -11,8 +11,8 @@ import ( type ( FileSystemView struct { - controller service.FileSystemController - settings repository.SettingsRepository + fsService service.FileSystemController + settings repository.SettingsRepository } FilePage struct { Page *service.Page @@ -26,15 +26,16 @@ func NewFileSystemView( settingsRepository repository.SettingsRepository, ) *FileSystemView { return &FileSystemView{ - controller: controller, - settings: settingsRepository, + fsService: controller, + settings: settingsRepository, } } func (self *FileSystemView) Index(ctx *fasthttp.RequestCtx) error { pathValue := string(ctx.FormValue("path")) + token := ext.GetTokenFromCtx(ctx) - page, err := self.controller.GetPage(pathValue) + page, err := self.fsService.GetPage(ctx, token.UserID, pathValue) if err != nil { return err } diff --git a/pkg/view/media.go b/pkg/view/media.go index 0b588f4..bea515d 100644 --- a/pkg/view/media.go +++ b/pkg/view/media.go @@ -98,7 +98,9 @@ func (self *MediaView) GetThumbnail(ctx *fasthttp.RequestCtx) error { path, err := self.mediaRepository.GetThumbnailPath(ctx, pathHash) if err != nil { - return self.GetImage(ctx) + ctx.Redirect("/media/image?path_hash="+pathHash, 307) + // nolint: nilerr + return nil } ctx.Request.Header.SetContentType("image/jpeg") |