Skip to content

Commit 98ebcaa

Browse files
committed
site/worker.js: allowlist sister-podcasts.html
gen-podcast.py publish-site uploads sister-podcasts.html to R2 but the site worker's ALLOWED_EXACT_FILES set did not include it, so every request 404'd even though the object was present. Same class of bug as the earlier YYYY/MM/index.html regression. Add sister-podcasts.html to the allowlist. Add a regression test that walks every root-level file publish-site uploads (index.html, sister-podcasts.html, sponsor.html, queue.html, feed.xml, queue.xml) and asserts isAllowedPath() returns true for each. This catches future regressions where someone adds a new root file to the publisher without updating the allowlist. Generated-by: Claude AI Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
1 parent 44c604b commit 98ebcaa

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

site/worker.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const ALLOWED_EXACT_FILES = new Set([
1818
'queue.html',
1919
'queue.xml',
2020
'sponsor.html',
21+
'sister-podcasts.html',
2122
'robots.txt',
2223
'favicon.ico',
2324
]);

site/worker.test.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,3 +315,38 @@ test('isAllowedPath accepts year-month archive paths', () => {
315315
assert.ok(!isAllowedPath('20266/04/index.html')); // 5-digit year
316316
assert.ok(!isAllowedPath('2026/04/sub/index.html')); // nested
317317
});
318+
319+
320+
test('sister-podcasts.html is served', async () => {
321+
const env = makeEnv({
322+
'sister-podcasts.html': '<html>Sister Podcasts</html>',
323+
});
324+
const req = makeRequest('/sister-podcasts.html');
325+
const resp = await worker.fetch(req, env);
326+
assert.equal(resp.status, 200);
327+
const body = await resp.text();
328+
assert.ok(body.includes('Sister Podcasts'));
329+
});
330+
331+
332+
test('all root-level HTML files uploaded by publish-site are allowlisted', () => {
333+
// gen-podcast.py _publish_site uploads these four HTML files at
334+
// the root. Each must be in ALLOWED_EXACT_FILES or the site worker
335+
// will 404 them even after a successful publish-site run. This is
336+
// the class of regression that hit us with sister-podcasts.html
337+
// (which the publisher uploaded but the worker rejected).
338+
const rootHtmlUploadedByPublishSite = [
339+
'index.html',
340+
'sister-podcasts.html',
341+
'sponsor.html',
342+
'queue.html',
343+
'feed.xml',
344+
'queue.xml',
345+
];
346+
for (const name of rootHtmlUploadedByPublishSite) {
347+
assert.ok(
348+
isAllowedPath(name),
349+
`${name} is uploaded by publish-site but not in the site worker allowlist`
350+
);
351+
}
352+
});

0 commit comments

Comments
 (0)