Skip to content

Write HTML. Render video. Built for agents.

fix(cli): narrow blocked page titles

Miguel Ángelb38e90740407
diff --git a/packages/cli/src/capture/pageBlockDetection.test.ts b/packages/cli/src/capture/pageBlockDetection.test.ts
index b180e55fb1..0c2cd9f0d6 100644
--- a/packages/cli/src/capture/pageBlockDetection.test.ts
+++ b/packages/cli/src/capture/pageBlockDetection.test.ts
@@ -70,6 +70,26 @@ describe("detectBlockedPage", () => {
hasChallengeElement: true,
},
},
+ {
+ label: "a minimal photography page named Forbidden Fruit Photography",
+ evidence: {
+ httpStatus: 200,
+ title: "Forbidden Fruit Photography",
+ textLength: 40,
+ bodyChildCount: 4,
+ hasChallengeElement: false,
+ },
+ },
+ {
+ label: "a minimal photo essay named Attention Required",
+ evidence: {
+ httpStatus: 200,
+ title: "Attention Required: A Photo Essay",
+ textLength: 60,
+ bodyChildCount: 5,
+ hasChallengeElement: false,
+ },
+ },
])("allows $label", ({ evidence }) => {
expect(detectBlockedPage(evidence)).toBeUndefined();
});
diff --git a/packages/cli/src/capture/pageBlockDetection.ts b/packages/cli/src/capture/pageBlockDetection.ts
index a103c081b5..435a9c5d3d 100644
--- a/packages/cli/src/capture/pageBlockDetection.ts
+++ b/packages/cli/src/capture/pageBlockDetection.ts
@@ -16,8 +16,8 @@ export function detectBlockedPage(evidence: PageLoadEvidence): string | undefine
const hasBlockedStatus =
evidence.httpStatus === 401 || evidence.httpStatus === 403 || evidence.httpStatus === 429;
const hasBlockedTitle =
- /^(?:error\s*)?(?:401|403|429)(?:\s*[-:—]\s*|\s+)|forbidden|access denied|attention required|just a moment/i.test(
- evidence.title,
+ /^(?:(?:error\s*)?(?:401|403|429)(?:\s*(?:[-:—]\s*)?(?:forbidden|unauthorized|access denied|too many requests))?|forbidden|access denied|attention required|just a moment(?:\.{3})?)(?:\s*[|—-]\s*(?:cloudflare|sucuri website firewall))?$/i.test(
+ evidence.title.trim(),
);
if (!isMinimalDom || (!evidence.hasChallengeElement && !hasBlockedStatus && !hasBlockedTitle)) {