mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 05:14:46 +02:00
Fix file download link (#959)
* fix mount of DownloadFiles * fix path in download url
This commit is contained in:
parent
dde5305b3f
commit
d5b8a4c501
@ -23,14 +23,21 @@ class DownloadFiles extends Page
|
|||||||
#[Locked]
|
#[Locked]
|
||||||
public string $path;
|
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();
|
$this->authorizeAccess();
|
||||||
|
|
||||||
/** @var Server $server */
|
/** @var Server $server */
|
||||||
$server = Filament::getTenant();
|
$server = Filament::getTenant();
|
||||||
|
|
||||||
$token = $service
|
$token = $this->nodeJWTService
|
||||||
->setExpiresAt(CarbonImmutable::now()->addMinutes(15))
|
->setExpiresAt(CarbonImmutable::now()->addMinutes(15))
|
||||||
->setUser(auth()->user())
|
->setUser(auth()->user())
|
||||||
->setClaims([
|
->setClaims([
|
||||||
|
@ -174,7 +174,7 @@ class ListFiles extends ListRecords
|
|||||||
->label('Download')
|
->label('Download')
|
||||||
->icon('tabler-download')
|
->icon('tabler-download')
|
||||||
->visible(fn (File $file) => $file->is_file)
|
->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')
|
Action::make('move')
|
||||||
->authorize(fn () => auth()->user()->can(Permission::ACTION_FILE_UPDATE, $server))
|
->authorize(fn () => auth()->user()->can(Permission::ACTION_FILE_UPDATE, $server))
|
||||||
->label('Move')
|
->label('Move')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user