Skip to content

Commit

Permalink
Merge pull request #6814 from getkirby/fix/6786-file-preview-links
Browse files Browse the repository at this point in the history
Fix file preview links
  • Loading branch information
bastianallgeier authored Nov 27, 2024
2 parents 8fc6f34 + 41353f7 commit 24bba50
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
6 changes: 0 additions & 6 deletions src/Cms/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -630,12 +630,6 @@ public function previewUrl(): string|null
case 'page':
$preview = $parent->blueprint()->preview();

// user has no permission to preview page,
// also return null for file preview
if ($preview === false) {
return null;
}

// the page has a custom preview setting,
// thus the file is only accessible through
// the direct media URL
Expand Down
4 changes: 2 additions & 2 deletions tests/Cms/Files/FileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ public function testPreviewUrlUnauthenticated()
]);

$file = $page->file('test.pdf');
$this->assertNull($file->previewUrl());
$this->assertSame('/media/pages/test/' . $file->mediaHash() . '/test.pdf', $file->previewUrl());
}

public function testPreviewUrlForDraft()
Expand Down Expand Up @@ -852,7 +852,7 @@ public function testPreviewUrlForPageWithDeniedPreviewSetting()
$app->impersonate('[email protected]');

$file = $app->file('test/test.pdf');
$this->assertNull($file->previewUrl());
$this->assertSame('/media/pages/test/' . $file->mediaHash() . '/test.pdf', $file->previewUrl());
}

public function testPreviewUrlForPageWithCustomPreviewSetting()
Expand Down

0 comments on commit 24bba50

Please sign in to comment.