Skip to content

Commit

Permalink
Fix file download link (#959)
Browse files Browse the repository at this point in the history
* fix mount of DownloadFiles

* fix path in download url
  • Loading branch information
Boy132 authored Jan 29, 2025
1 parent dde5305 commit d5b8a4c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit d5b8a4c

Please sign in to comment.