Skip to content

Commit

Permalink
Merge pull request #2132 from gitnnolabs/fix_pdf_route
Browse files Browse the repository at this point in the history
Adiciona uma verificação nas rotas legadas dos PDFs para garantir um 404 quando o periódico não existe.
  • Loading branch information
gitnnolabs authored Nov 17, 2021
2 parents f1c6ad4 + ea18049 commit 9a15db3
Show file tree
Hide file tree
Showing 8 changed files with 165 additions and 111 deletions.
8 changes: 8 additions & 0 deletions opac/webapp/main/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1424,10 +1424,18 @@ def article_detail_pdf(url_seg, url_seg_issue, url_seg_article, lang_code=''):
@cache.cached(key_prefix=cache_key_with_lang_with_qs)
def router_legacy_pdf(journal_acron, issue_info, pdf_filename):
pdf_filename = '%s.pdf' % pdf_filename

journal = controllers.get_journal_by_url_seg(journal_acron)

if not journal:
abort(404, _('Este PDF não existe em http://www.scielo.br. Consulte http://search.scielo.org'))

article = controllers.get_article_by_pdf_filename(
journal_acron, issue_info, pdf_filename)

if not article:
abort(404, _('PDF do artigo não foi encontrado'))

return redirect(
url_for(
'main.article_detail_v3',
Expand Down
2 changes: 1 addition & 1 deletion opac/webapp/templates/errors/500.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{% block error_message %}

{% trans %}Erro interno do servidor. Tente novamente mais tarde. Nossos engenheiros foram notificados.{% endtrans %}
{% trans %}Erro interno do servidor. Tente novamente mais tarde.{% endtrans %}

{% if g.sentry_event_id %}
<p>
Expand Down
42 changes: 22 additions & 20 deletions opac/webapp/translations/en/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ msgid ""
msgstr ""
"Project-Id-Version: OPAC\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2021-10-18 09:36-0300\n"
"POT-Creation-Date: 2021-11-17 16:45+0000\n"
"PO-Revision-Date: 2018-03-06 19:50+0000\n"
"Last-Translator: jamil Atta <[email protected]>\n"
"Language: en\n"
Expand Down Expand Up @@ -935,7 +935,7 @@ msgstr "Authors"
#: opac/webapp/templates/article/includes/levelMenu_abstracts.html:26
#: opac/webapp/templates/collection/includes/levelMenu_search.html:29
#: opac/webapp/templates/collection/includes/levelMenu_search.html:72
#: opac/webapp/templates/issue/toc.html:161
#: opac/webapp/templates/issue/toc.html:164
msgid "Resumo"
msgstr "Abstract"

Expand Down Expand Up @@ -1050,12 +1050,12 @@ msgstr "Latest journals added to the collection"
msgid "10 últimos periódicos inseridos na coleção %s"
msgstr "10 latest journals added to the collection %s"

#: opac/webapp/main/views.py:347 opac/webapp/main/views.py:1650
#: opac/webapp/main/views.py:347 opac/webapp/main/views.py:1658
msgid "Página não encontrada"
msgstr ""

#: opac/webapp/main/views.py:372 opac/webapp/main/views.py:461
#: opac/webapp/main/views.py:1449
#: opac/webapp/main/views.py:1457
#, python-format
msgid "Requsição inválida ao tentar acessar o artigo com pid: %s"
msgstr ""
Expand All @@ -1075,7 +1075,7 @@ msgstr "Issue not found"
#: opac/webapp/main/views.py:416 opac/webapp/main/views.py:448
#: opac/webapp/main/views.py:1038 opac/webapp/main/views.py:1138
#: opac/webapp/main/views.py:1188 opac/webapp/main/views.py:1410
#: opac/webapp/main/views.py:1453
#: opac/webapp/main/views.py:1461
msgid "Artigo não encontrado"
msgstr "Article not found"

Expand Down Expand Up @@ -1173,11 +1173,17 @@ msgstr "Insufficient parameters to obtain article's EPDF"
msgid "PDF não encontrado"
msgstr ""

#: opac/webapp/main/views.py:1430
#: opac/webapp/main/views.py:1431
msgid ""
"Este PDF não existe em http://www.scielo.br. Consulte "
"http://search.scielo.org/""
msgstr "This PDF does not exist in https//www.scielo.br. See https://search.scielo.org"

#: opac/webapp/main/views.py:1437
msgid "PDF do artigo não foi encontrado"
msgstr "Article's PDF not found"

#: opac/webapp/main/views.py:1472 opac/webapp/main/views.py:1503
#: opac/webapp/main/views.py:1480 opac/webapp/main/views.py:1511
msgid "Requisição inválida."
msgstr "Invalid request"

Expand Down Expand Up @@ -1471,7 +1477,7 @@ msgstr "Download PDF (Portuguese)"

#: opac/webapp/templates/article/includes/levelMenu_texts.html:5
#: opac/webapp/templates/article/includes/levelMenu_texts.html:27
#: opac/webapp/templates/issue/toc.html:174
#: opac/webapp/templates/issue/toc.html:177
msgid "Texto"
msgstr "Text"

Expand All @@ -1480,7 +1486,7 @@ msgid "Texto "
msgstr ""

#: opac/webapp/templates/article/includes/recent_articles_row.html:6
#: opac/webapp/templates/issue/toc.html:141
#: opac/webapp/templates/issue/toc.html:144
msgid "Documento sem título"
msgstr "Untitled document"

Expand Down Expand Up @@ -1893,12 +1899,8 @@ msgstr ""
"please check it and try again."

#: opac/webapp/templates/errors/500.html:5
msgid ""
"Erro interno do servidor. Tente novamente mais tarde. Nossos engenheiros "
"foram notificados."
msgstr ""
"Internal server error. Please try again later. Our technical staff has "
"been notified."
msgid "Erro interno do servidor. Tente novamente mais tarde."
msgstr "Internal server error. Please try again later."

#: opac/webapp/templates/errors/500.html:9
msgid "Id. do erro"
Expand Down Expand Up @@ -2049,20 +2051,20 @@ msgstr "Newest first"
msgid "Mais antigos primeiro"
msgstr "Oldest first"

#: opac/webapp/templates/issue/toc.html:105
#: opac/webapp/templates/issue/toc.html:107
#: opac/webapp/templates/issue/toc.html:106
#: opac/webapp/templates/issue/toc.html:108
msgid "Todas as seções"
msgstr "All the sections"

#: opac/webapp/templates/issue/toc.html:185
#: opac/webapp/templates/issue/toc.html:188
msgid "PDF"
msgstr ""

#: opac/webapp/templates/issue/toc.html:196
#: opac/webapp/templates/issue/toc.html:199
msgid "ePDF"
msgstr ""

#: opac/webapp/templates/issue/toc.html:211
#: opac/webapp/templates/issue/toc.html:214
msgid "Resumo em"
msgstr "Abstract in"

Expand Down
47 changes: 27 additions & 20 deletions opac/webapp/translations/es/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ msgid ""
msgstr ""
"Project-Id-Version: OPAC\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2021-10-18 09:36-0300\n"
"POT-Creation-Date: 2021-11-17 16:48+0000\n"
"PO-Revision-Date: 2018-03-07 00:47+0000\n"
"Last-Translator: jamil Atta <[email protected]>\n"
"Language: es\n"
Expand Down Expand Up @@ -938,7 +938,7 @@ msgstr "Autores"
#: opac/webapp/templates/article/includes/levelMenu_abstracts.html:26
#: opac/webapp/templates/collection/includes/levelMenu_search.html:29
#: opac/webapp/templates/collection/includes/levelMenu_search.html:72
#: opac/webapp/templates/issue/toc.html:161
#: opac/webapp/templates/issue/toc.html:164
msgid "Resumo"
msgstr "Resumen"

Expand Down Expand Up @@ -1051,12 +1051,12 @@ msgstr "Últimas revistas incluidas en la colección"
msgid "10 últimos periódicos inseridos na coleção %s"
msgstr "10 últimas revistas incluidas en la colección %s"

#: opac/webapp/main/views.py:347 opac/webapp/main/views.py:1650
#: opac/webapp/main/views.py:347 opac/webapp/main/views.py:1658
msgid "Página não encontrada"
msgstr "Página no encontrada"

#: opac/webapp/main/views.py:372 opac/webapp/main/views.py:461
#: opac/webapp/main/views.py:1449
#: opac/webapp/main/views.py:1457
#, python-format
msgid "Requsição inválida ao tentar acessar o artigo com pid: %s"
msgstr "Requiere no válida al intentar tener acceso al artículo con pid:% s"
Expand All @@ -1076,7 +1076,7 @@ msgstr "Fascículo no encontrado"
#: opac/webapp/main/views.py:416 opac/webapp/main/views.py:448
#: opac/webapp/main/views.py:1038 opac/webapp/main/views.py:1138
#: opac/webapp/main/views.py:1188 opac/webapp/main/views.py:1410
#: opac/webapp/main/views.py:1453
#: opac/webapp/main/views.py:1461
msgid "Artigo não encontrado"
msgstr "Artículo no encontrado"

Expand Down Expand Up @@ -1174,11 +1174,17 @@ msgstr "Parámetros insuficientes para obtener el EPDF del artículo"
msgid "PDF não encontrado"
msgstr ""

#: opac/webapp/main/views.py:1430
#: opac/webapp/main/views.py:1431
msgid ""
"Este PDF não existe em http://www.scielo.br. Consulte "
"http://search.scielo.org"
msgstr "Este PDF no existe en http://www.scielo.br. Ver http://search.scielo.org"

#: opac/webapp/main/views.py:1437
msgid "PDF do artigo não foi encontrado"
msgstr "PDF del artículo no encontrado"

#: opac/webapp/main/views.py:1472 opac/webapp/main/views.py:1503
#: opac/webapp/main/views.py:1480 opac/webapp/main/views.py:1511
msgid "Requisição inválida."
msgstr "Petición inválida."

Expand Down Expand Up @@ -1473,7 +1479,7 @@ msgstr ""

#: opac/webapp/templates/article/includes/levelMenu_texts.html:5
#: opac/webapp/templates/article/includes/levelMenu_texts.html:27
#: opac/webapp/templates/issue/toc.html:174
#: opac/webapp/templates/issue/toc.html:177
msgid "Texto"
msgstr "Texto"

Expand All @@ -1482,7 +1488,7 @@ msgid "Texto "
msgstr ""

#: opac/webapp/templates/article/includes/recent_articles_row.html:6
#: opac/webapp/templates/issue/toc.html:141
#: opac/webapp/templates/issue/toc.html:144
msgid "Documento sem título"
msgstr "Documento sin título"

Expand Down Expand Up @@ -1895,12 +1901,8 @@ msgstr ""
"por favor, revise e intente nuevamente."

#: opac/webapp/templates/errors/500.html:5
msgid ""
"Erro interno do servidor. Tente novamente mais tarde. Nossos engenheiros "
"foram notificados."
msgstr ""
"Error interno del servidor. Intente nuevamente luego. Nuestros ingenieros"
" fueron notificados."
msgid "Erro interno do servidor. Tente novamente mais tarde."
msgstr "Error interno del servidor. Intente nuevamente luego."

#: opac/webapp/templates/errors/500.html:9
msgid "Id. do erro"
Expand Down Expand Up @@ -2049,20 +2051,20 @@ msgstr ""
msgid "Mais antigos primeiro"
msgstr ""

#: opac/webapp/templates/issue/toc.html:105
#: opac/webapp/templates/issue/toc.html:107
#: opac/webapp/templates/issue/toc.html:106
#: opac/webapp/templates/issue/toc.html:108
msgid "Todas as seções"
msgstr "Todas las secciones"

#: opac/webapp/templates/issue/toc.html:185
#: opac/webapp/templates/issue/toc.html:188
msgid "PDF"
msgstr ""

#: opac/webapp/templates/issue/toc.html:196
#: opac/webapp/templates/issue/toc.html:199
msgid "ePDF"
msgstr ""

#: opac/webapp/templates/issue/toc.html:211
#: opac/webapp/templates/issue/toc.html:214
msgid "Resumo em"
msgstr "Resumen en"

Expand Down Expand Up @@ -2424,3 +2426,8 @@ msgstr "Ver"
#~ msgid "Este documento contém correções"
#~ msgstr "Este documento tiene una errata"

#~ msgid ""
#~ "Este PDF não existe em "
#~ "http://www.scielo.br. Consulte http://search.scielo.org\""
#~ msgstr ""

Loading

0 comments on commit 9a15db3

Please sign in to comment.