Repository navigation
fix(x-robots-tag): allow max-snippet -1 (no snippet-length limit) - #1227
Merged
ferhatelmas merged 1 commit intoJul 15, 2026
Merged
ferhatelmas merged 1 commit into
ferhatelmas merged 1 commit into
Conversation
ferhatelmas
reviewed
Jul 14, 2026
ferhatelmas
approved these changes
Jul 14, 2026
ferhatelmas
force-pushed
the
fix/x-robots-tag-max-snippet-allow-minus-one
branch
from
July 14, 2026 12:49
13f6926 to
416cb1a
Compare
Coverage Report for CI Build 29400745661Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Coverage increased (+0.1%) to 79.479%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
ferhatelmas
force-pushed
the
fix/x-robots-tag-max-snippet-allow-minus-one
branch
from
July 15, 2026 08:00
416cb1a to
3e30a2c
Compare
The max-snippet validator rejected -1 (guard was num < 0), but per the robots
meta spec -1 means 'no snippet-length limit' and is a valid value (alongside 0
and any positive integer) — it's the recommended default. The sibling
max-video-preview case already uses num < -1 correctly; max-snippet was an
inconsistent oversight.
Loosen the guard to num < -1 and align the error message with max-video-preview
('must be a number >= -1'). Update the existing negative-value test to -5 and
add a case asserting -1 is accepted.
ferhatelmas
force-pushed
the
fix/x-robots-tag-max-snippet-allow-minus-one
branch
from
July 15, 2026 08:25
3e30a2c to
8e218c8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
max-snippetX-Robots-Tag validator (src/storage/validators/x-robots-tag.ts) rejects-1:Per the robots meta tag spec,
max-snippet: -1means "no snippet-length limit" and is a valid value (alongside0and any positive integer) — in fact it's the recommended default (max-snippet:-1, max-image-preview:large, max-video-preview:-1). The siblingmax-video-previewcase in the same file already handles this correctly withnum < -1;max-snippetwas an inconsistent oversight.So a user setting the spec-recommended
X-Robots-Tag: max-snippet:-1gets a400 InvalidXRobotsTagerror.Fix
Loosen the guard to
num < -1and align the error message withmax-video-preview("must be a number >= -1"). Update the existing negative-value test to-5(still rejected) and add a case asserting-1is accepted.Tests
src/storage/validators/x-robots-tag.test.ts: adds "acceptsmax-snippet: -1", keeps "throws below -1" (-5) and "throws for non-numeric" (abc).Note on verification: I confirmed the edited validator logic directly (
-1accepted;-5/abcstill rejected;max-video-previewunchanged), but couldn't run the fullvitestsuite locally —supabase/storagedoesn't install on Windows (fs-xattrisos: "!win32"and the repo requires Node ≥ 24). The change is a one-line guard + test, so CI should confirm.