Relative links in a page whose URL contains `//` are resolved with the slashes collapsed
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 68/100
Direção de pesquisa
Start in ArticleUrlRewriter.__call__, where the issue shows nested urllib.parse.urljoin calls for article_url, base_href, and item_url; read the resolver tests from #344 for the existing approach. Check both relative-link and base_href resolution with URLs containing consecutive slashes, and confirm the resulting ZIM path preserves the empty segments.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Follow-up to #344 / #340.
When a page's own URL contains consecutive slashes, relative links inside it are resolved with urllib.parse.urljoin, which drops the empty segments. So the // gets collapsed before normalize() even sees the URL.
Example (from @Sinkleberg's check in #344): rewriting other.html from https://example.com/x//y/page.html gives the ZIM path example.com/x/y/other.html, but a browser (WHATWG URL resolution) resolves it to https://example.com/x//y/other.html. So the link points to an entry that doesn't exist.
This is in ArticleUrlRewriter.__call__:
item_absolute_url = urljoin(
urljoin(self.article_url.value, base_href), item_url
)
The same applies to base_href resolution. A fix probably needs an RFC 3986 / WHATWG-style join that keeps empty segments instead of urljoin. #344 already has a small resolver like that in its tests.
- Linguagem predominante
- Python
- Estrelas
- 31
- Forks
- 31
- Merge médio
- 2d 5h
- PRs com merge (30d)
- 3
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de openzim/python-scraperlib
-
HTML rewriting: also rewrite `poster` attributeTalvez já em andamento @anshuman83-40 assumiu há 1 dia. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
openzim/python-scraperlib#339 · 1 comentário ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
openzim/python-scraperlib#292 ·
-
URL normalisation: do not rewrite consecutive slashes `//` as a single slash `/`Talvez já em andamento @anshuman83-40 assumiu há 8 dias. Aberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 45/100
openzim/python-scraperlib#340 ·
-
Add fuzzy rule to rewrite URLs of lesbases.anct.gouv.frTalvez livre de novo @benoit74 assumiu há 52 dias e não há nenhum pull request aberto. Aberta
openzim/python-scraperlib#334 · 1 responsável ·
-
Add utility to index ePub documents contentTalvez já em andamento @Sriram-PR assumiu há 5 dias. Aberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 55/100
openzim/python-scraperlib#333 · 1 comentário ·
Todas as issues de openzim/python-scraperlib
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
KalicoCrew/kalico#1012 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 82/100
esphome/esphome.io#7657 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
VNG-Realisatie/gemma-zaken#2658 ·
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 75/100
Mantenedores costumam responder em até 1 dia
-
comp/gateway comp/plugins duplicate P3 type/bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
NousResearch/hermes-agent#137019 ·
Mantenedores costumam responder em até 1 dia