fix: retain original image titles when proxying previews

This commit is contained in:
kl
2026-10-08 13:02:39 +08:00
parent 6b948fa675
commit 86c2b8d552
3 changed files with 21 additions and 20 deletions

View File

@@ -0,0 +1,14 @@
import { test, expect } from '@playwright/test';
const fixtureBase = process.env.FIXTURE_BASE_URL || 'http://127.0.0.1:18080';
for (const proxy of [false, true]) {
test(`image title retains the source filename with kkagent=${proxy}`, async ({ page }) => {
const source = `${fixtureBase}/sample.png`;
const encoded = encodeURIComponent(Buffer.from(source).toString('base64'));
const response = await page.goto(`/onlinePreview?url=${encoded}&kkagent=${proxy}`);
expect(response?.status()).toBe(200);
await expect(page.locator('.viewer-title')).toHaveText('sample.png');
});
}