feat(cms): sync site assets, revalidate webhook, and document download naming

This commit is contained in:
2026-02-10 23:38:31 +08:00
parent c4969cd4d2
commit b6e18a83ec
27 changed files with 1019 additions and 26 deletions

View File

@@ -239,4 +239,44 @@ class DocumentTest extends TestCase
$document->refresh();
$this->assertEquals(2, $document->version_count);
}
/**
* Test public download returns UTF-8 compatible content disposition
*/
public function test_public_document_download_uses_utf8_content_disposition(): void
{
$category = DocumentCategory::factory()->create();
$document = Document::factory()->create([
'created_by_user_id' => $this->admin->id,
'document_category_id' => $category->id,
'access_level' => 'public',
'status' => 'active',
'version_count' => 0,
]);
$filePath = 'documents/charter-v2.pdf';
Storage::disk('private')->put($filePath, 'pdf-content');
Storage::put($filePath, 'pdf-content');
$document->addVersion(
filePath: $filePath,
originalFilename: '台灣尤塞氏症暨視聽弱協會章程V2.pdf',
mimeType: 'application/pdf',
fileSize: Storage::disk('private')->size($filePath),
uploadedBy: $this->admin,
versionNotes: '初始版本'
);
$response = $this->get(route('documents.public.download', [
'uuid' => $document->public_uuid,
]));
$response->assertOk();
$disposition = (string) $response->headers->get('Content-Disposition');
$this->assertStringContainsString(
"filename*=UTF-8''".rawurlencode('台灣尤塞氏症暨視聽弱協會章程V2.pdf'),
$disposition
);
}
}