Fix logo URL double concatenation in OpenGraph meta tags#367
Draft
Fix logo URL double concatenation in OpenGraph meta tags#367
Conversation
Co-authored-by: robertatakenaka <505143+robertatakenaka@users.noreply.github.com>
Co-authored-by: robertatakenaka <505143+robertatakenaka@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix logo link formation error in meta.html
Fix logo URL double concatenation in OpenGraph meta tags
Dec 19, 2025
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.
O que esse PR faz?
Corrige a concatenação duplicada de URLs quando
journal.logo_urljá contém uma URL absoluta (comhttp://ouhttps://), resultando em URLs malformadas comohttps://scielo.do/http://core.scielo.org/media/logo.png.Solução: Criado filtro Jinja2
get_absolute_urlque detecta URLs absolutas e as retorna sem concatenação, mantendo compatibilidade com URLs relativas.Arquivos modificados:
opac/webapp/main/custom_filters.py- Funçãoget_absolute_url()opac/webapp/__init__.py- Registro do filtroopac/webapp/templates/{journal,issue,article}/includes/meta.html- Uso do novo filtroopac/tests/test_main_custom_filters.py- Testes unitáriosOnde a revisão poderia começar?
opac/webapp/main/custom_filters.py- Lógica do filtroget_absolute_url()Depois verificar aplicação nos templates em
opac/webapp/templates/*/includes/meta.htmlComo este poderia ser testado manualmente?
logo_urlabsoluto:http://core.scielo.org/media/logo.png/j/rscd)og:imageno HTMLValidação:
Algum cenário de contexto que queira dar?
O problema ocorre quando periódicos usam logos hospedados em domínios externos (SSM/CDN). O template original assumia que
logo_urlera sempre relativo, fazendo concatenação incondicional comrequest.url_root.URLs relativas continuam funcionando normalmente:
/media/logo.png→https://scielo.do/media/logo.png✓Screenshots
Meta tag og:image com URL malformada antes da correção
Quais são tickets relevantes?
Issue: Correção do link do logo
Referências
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.