diff --git a/app/Filament/Server/Resources/FileResource/Pages/DownloadFiles.php b/app/Filament/Server/Resources/FileResource/Pages/DownloadFiles.php index 2f147f68a9..3a710f1210 100644 --- a/app/Filament/Server/Resources/FileResource/Pages/DownloadFiles.php +++ b/app/Filament/Server/Resources/FileResource/Pages/DownloadFiles.php @@ -23,14 +23,21 @@ class DownloadFiles extends Page #[Locked] public string $path; - public function mount(string $path, NodeJWTService $service): void + private NodeJWTService $nodeJWTService; + + public function boot(NodeJWTService $nodeJWTService): void + { + $this->nodeJWTService = $nodeJWTService; + } + + public function mount(string $path): void { $this->authorizeAccess(); /** @var Server $server */ $server = Filament::getTenant(); - $token = $service + $token = $this->nodeJWTService ->setExpiresAt(CarbonImmutable::now()->addMinutes(15)) ->setUser(auth()->user()) ->setClaims([ diff --git a/app/Filament/Server/Resources/FileResource/Pages/ListFiles.php b/app/Filament/Server/Resources/FileResource/Pages/ListFiles.php index 9106337992..b68b69586d 100644 --- a/app/Filament/Server/Resources/FileResource/Pages/ListFiles.php +++ b/app/Filament/Server/Resources/FileResource/Pages/ListFiles.php @@ -174,7 +174,7 @@ public function table(Table $table): Table ->label('Download') ->icon('tabler-download') ->visible(fn (File $file) => $file->is_file) - ->url(fn () => DownloadFiles::getUrl(['path' => $this->path]), true), + ->url(fn (File $file) => DownloadFiles::getUrl(['path' => join_paths($this->path, $file->name)]), true), Action::make('move') ->authorize(fn () => auth()->user()->can(Permission::ACTION_FILE_UPDATE, $server)) ->label('Move')