test(e2e): expand archive format coverage (tar/tgz/7z/rar) (#720)

* test(e2e): expand archive coverage to tar/tgz/7z/rar

* test: address copilot archive fixture review feedback

* test(e2e): add rar smoke coverage and align archive deps

* test(e2e): make tgz fixture gzip header deterministic

* test(e2e): keep legacy zip temp dir ignored

* test(e2e): address remaining copilot review comments

* test(e2e): make 7z fixture generation deterministic and strict

* test(e2e): fail fast when sample.rar fixture is missing
This commit is contained in:
kl
2026-03-09 12:44:48 +08:00
committed by GitHub
parent b10e14899d
commit d1c310ab63
10 changed files with 124 additions and 20 deletions

View File

@@ -25,6 +25,10 @@ test.beforeAll(async () => {
'sample.xlsx',
'sample.pptx',
'sample.zip',
'sample.tar',
'sample.tgz',
'sample.7z',
'sample.rar',
];
try {
@@ -97,13 +101,33 @@ test('12 zip preview', async ({ request }) => {
expect(resp.status()).toBe(200);
});
test('13 security: block 10.x host in onlinePreview', async ({ request }) => {
test('13 tar preview', async ({ request }) => {
const resp = await openPreview(request, `${fixtureBase}/sample.tar`);
expect(resp.status()).toBe(200);
});
test('14 tgz preview', async ({ request }) => {
const resp = await openPreview(request, `${fixtureBase}/sample.tgz`);
expect(resp.status()).toBe(200);
});
test('15 7z preview', async ({ request }) => {
const resp = await openPreview(request, `${fixtureBase}/sample.7z`);
expect(resp.status()).toBe(200);
});
test('16 rar preview', async ({ request }) => {
const resp = await openPreview(request, `${fixtureBase}/sample.rar`);
expect(resp.status()).toBe(200);
});
test('17 security: block 10.x host in onlinePreview', async ({ request }) => {
const resp = await openPreview(request, `http://10.1.2.3/a.pdf`);
const body = await resp.text();
expect(body).toContain('不受信任');
});
test('14 security: block 10.x host in getCorsFile', async ({ request }) => {
test('18 security: block 10.x host in getCorsFile', async ({ request }) => {
const encoded = b64('http://10.1.2.3/a.pdf');
const resp = await request.get(`/getCorsFile?urlPath=${encoded}`);
const body = await resp.text();