diff options
| author | Yevhen Bondarenko <evgeniy.bondarenko@sentrium.io> | 2026-07-22 17:18:19 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-22 17:18:19 +0200 |
| commit | a083130560c6c02fc0f21bb2e80c20aa9a21de42 (patch) | |
| tree | f9487f63167d25738e30b6636d6bc3bd6a9dbd90 /workers | |
| parent | cb729a56ecf68486d6cd08e08fd3b4155ae65caa (diff) | |
| parent | f1dcd5ac53decfb3b11c7eb281ddfb3ea4c94d12 (diff) | |
| download | vyos-documentation-a083130560c6c02fc0f21bb2e80c20aa9a21de42.tar.gz vyos-documentation-a083130560c6c02fc0f21bb2e80c20aa9a21de42.zip | |
Merge pull request #2159 from vyos/claude/smoke-hardening
docs-gates: smoke per-probe retry + explicit UA; workers: broaden asset-ext classification
Diffstat (limited to 'workers')
| -rw-r--r-- | workers/branch/src/index.ts | 7 | ||||
| -rw-r--r-- | workers/branch/test/content.test.ts | 3 |
2 files changed, 6 insertions, 4 deletions
diff --git a/workers/branch/src/index.ts b/workers/branch/src/index.ts index 7cdaaf14..47ef3ad6 100644 --- a/workers/branch/src/index.ts +++ b/workers/branch/src/index.ts @@ -6,13 +6,12 @@ export interface Env { export type CacheClass = "page" | "asset"; -// Binary/media assets get the longer asset cache class, alongside .pdf and the Sphinx -// /_static/ (theme) + /_images/ (figure) trees. -const ASSET_EXT_RE = /\.(png|jpe?g|svg|gif|ico|woff2?|ttf|eot)$/i; +// Binary/media asset extensions (case-insensitive, so ".PDF" also matches) get the longer +// asset cache class, alongside the Sphinx /_static/ (theme) + /_images/ (figure) trees. +const ASSET_EXT_RE = /\.(pdf|png|jpe?g|webp|svg|gif|ico|woff2?|ttf|otf|eot)$/i; export function classifyPath(path: string): CacheClass { if ( - path.endsWith(".pdf") || path.includes("/_static/") || path.includes("/_images/") || ASSET_EXT_RE.test(path) diff --git a/workers/branch/test/content.test.ts b/workers/branch/test/content.test.ts index 94a0d5a6..6d04c35b 100644 --- a/workers/branch/test/content.test.ts +++ b/workers/branch/test/content.test.ts @@ -243,8 +243,11 @@ describe("asset cache-class classification (ยง3.3, extended)", () => { "/en/rolling/_static/fonts/roboto.woff2", "/en/rolling/logo.svg", "/en/rolling/photo.jpeg", + "/en/rolling/hero.webp", // webp added to ASSET_EXT_RE (standalone path) + "/en/rolling/font.otf", // otf added to ASSET_EXT_RE (standalone path) "/en/rolling/icon.ico", "/en/rolling/vyos-documentation.pdf", + "/en/rolling/vyos-documentation.PDF", // .pdf folded into the case-insensitive regex ]) { expect(classifyPath(p)).toBe("asset"); } |
