Skip to content

fix: ignore URL suffixes when scoring file extensions - #2405

Open
linjiaye929 wants to merge 1 commit into
unclecode:developfrom
linjiaye929:bugfix/content-type-url-suffix
Open

linjiaye929 wants to merge 1 commit into
unclecode:developfrom
linjiaye929:bugfix/content-type-url-suffix

Conversation

@linjiaye929

Copy link
Copy Markdown

Summary

ContentTypeScorer({'.pdf$': 1.0}) gives report.pdf?version=1.2 a zero score because extension lookup uses the last dot in the whole URL. Dotted fragments and path parameters have the same effect; dots in parent directories can also score an extensionless final segment incorrectly.

Bound extension lookup to the final slash-delimited segment before its suffixes. Keep regex fallback on the original URL and preserve weights/cache behavior. This is not a general URL-parser change; authority-only URL behavior is unchanged.

Validation

  • Eleven new assertion-based public-score tests: seven failures on the original code, all passing with the fix. Fourteen tests pass in the focused run; some existing scorer coverage is diagnostic-only.
  • No network access. New tests pass Black; existing production formatting debt is left unchanged. Full suite not run.
  • Hosted workflows may require maintainer approval; no hosted pass is claimed.

AI assistance was used for implementation, testing, and review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant