Skip to content

Commit 974f30a

Browse files
committed
fix the download button
1 parent 9ddd80d commit 974f30a

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

src/Resources/views/infolists/components/previews/download.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<div class="filament-library-unpreviewable-button">
88
<x-filament::button
99
tag="a"
10-
href="{{ $fileUrl }}"
10+
:href="$fileUrl"
1111
target="_blank"
1212
icon="heroicon-o-arrow-down-tray"
1313
color="primary"

tests/Unit/LibraryFilePreviewResolverTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,3 +193,15 @@ function previewMedia(array $attributes, ?string $diskPath = null, ?string $cont
193193
expect($html)->toContain('<h1')
194194
->and($html)->toContain('Paragraph text.');
195195
});
196+
197+
it('renders download preview button with unescaped signed url query params', function (): void {
198+
$signedUrl = 'https://example.test/file.txt?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Signature=abc123';
199+
200+
$html = view('filament-library::infolists.components.previews.download', [
201+
'fileUrl' => $signedUrl,
202+
'message' => 'This file type cannot be previewed. Please download to view.',
203+
])->render();
204+
205+
expect($html)->toContain('href="' . $signedUrl . '"')
206+
->and($html)->not->toContain('&amp;amp;');
207+
});

0 commit comments

Comments
 (0)