ContentTypeFilter rejects every URL that carries a query string or fragment

Aperta
#2,554 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@HhH666-ux ci sta già lavorando.

Dal 13/11/2026.

  • #2555 di @HhH666-ux — aperta

Valutazione

Difficoltà
1/5
Tempo stimato
1-3 ore
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
data

Direzione di ricerca

Start with ContentTypeFilter._extract_extension in crawl4ai/deep_crawling/filters.py, and compare it with how URLPatternFilter uses urlparse(url).path. Strip the fragment and query before splitting the extension, then check that page.html?v=2 and page.html#section report html while extensionless URLs stay allowed. Done means regression tests cover these cases. Open PR #2555 already targets this, so coordinate with it before starting.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Description

ContentTypeFilter._extract_extension() reads the extension from the raw URL, so a query string or fragment becomes part of it:

from crawl4ai.deep_crawling.filters import ContentTypeFilter

f = ContentTypeFilter(allowed_types=["text/html"])
f.apply("https://example.com/page.html")            # True
f.apply("https://example.com/page.html?v=2")        # False  (extension parsed as "html?v=2")
f.apply("https://example.com/page.html#section")    # False

Any allowed HTML page reachable only through a query string (pagination, ?utm_* links, anchors) is therefore filtered out during deep crawling. URLPatternFilter already parses urlparse(url).path, so this looks like a miss in _extract_extension rather than intended behaviour.

Expected behaviour

Strip #... and ?... before splitting the path, so page.html?v=2 reports html. URLs without an extension should stay allowed, as they are today. I will open a small PR with regression tests.

Lingua principale
Python
Stelle
87.2k
Fork
9.1k
Merge medio
1g 6h
PR unite (30g)
25

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di unclecode/crawl4ai

Tutte le issue di unclecode/crawl4ai

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.