Skip to content

Commit

Permalink
#17 Fix critical bug that prevents user from downloading program stat…
Browse files Browse the repository at this point in the history
…ic files
  • Loading branch information
Mazuh committed Jul 12, 2017
1 parent 8a604e1 commit 925ed42
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion MinervaEnv/Minerva/templates/documents_view.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ <h2>&raquo Documentos</h2>
<tr>
<td>{{ document.cod }}</td>
<td>{{ document.title }}</td>
<td><a href="/static/upload_files/{{ std.post_graduation.initials }}/{{ document.file }}" target="_blank"><span class="glyphicon glyphicon-download-alt" aria-hidden="true"></span></a></td>
<td><a href="{{ url_for('download_documents', initials=std.post_graduation.initials, filename=document.file) }}" target="_blank"><span class="glyphicon glyphicon-download-alt" aria-hidden="true"></span></a></td>
</tr>
{% endfor %}
</table>
Expand Down
9 changes: 9 additions & 0 deletions MinervaEnv/Minerva/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ def home(initials=DEFAULT_POST_GRADUATION_INITIALS):



@app.route('/<string:initials>/documents/<string:filename>/')
def download_documents(initials, filename):
"""
Open a file from static folder.
"""
return app.send_static_file('upload_files/' + initials.lower() + '/' + filename)



@app.route('/<string:initials>/disciplinas/')
def view_subjects(initials):
"""Render a view for subjects."""
Expand Down
14 changes: 7 additions & 7 deletions dev_db/standard_installation.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,55 +569,55 @@ db.officialDocuments.insertMany([
'ownerProgram': PPGP_ID,
'title': 'Procedimentos de Defesa',
'cod': '04-2014',
'file': 'regimento_PROCEDIMENTOS-DE-DEFESA.docx',
'file': 'resolucao_PROCEDIMENTOS-DE-DEFESA.docx',
'insertedOn': new Date(2017, 04, 03, 09, 00, 00, 00),
'insertedBy': 'Marcell Guilherme Costa da Silva'
},
{
'ownerProgram': PPGP_ID,
'title': 'Exame de Qualificação',
'cod': '05-2014',
'file': 'regimento_EXAME-DE-QUALIFICACAO.docx',
'file': 'resolucao_EXAME-DE-QUALIFICACAO.docx',
'insertedOn': new Date(2017, 04, 03, 09, 00, 00, 00),
'insertedBy': 'Marcell Guilherme Costa da Silva'
},
{
'ownerProgram': PPGP_ID,
'title': 'Credenciamento Docente',
'cod': '06-2014',
'file': 'regimento_CREDENCIAMENTO-DOCENTE.docx',
'file': 'resolucao_CREDENCIAMENTO-DOCENTE.docx',
'insertedOn': new Date(2017, 04, 03, 09, 00, 00, 00),
'insertedBy': 'Marcell Guilherme Costa da Silva'
},
{
'ownerProgram': PPGP_ID,
'title': 'Resolução de Calendário',
'cod': '07-2014',
'file': 'regimento_RESOLUCAO-CALENDARIO.docx',
'file': 'resolucao_RESOLUCAO-CALENDARIO.docx',
'insertedOn': new Date(2017, 04, 03, 09, 00, 00, 00),
'insertedBy': 'Marcell Guilherme Costa da Silva'
},
{
'ownerProgram': PPGP_ID,
'title': 'Áreas de Concentração e Linhas de Pesquisa',
'cod': '08-2014',
'file': 'regimento_LINHAS-PESQUISA.docx',
'file': 'resolucao_LINHAS-PESQUISA.docx',
'insertedOn': new Date(2017, 04, 03, 09, 00, 00, 00),
'insertedBy': 'Marcell Guilherme Costa da Silva'
},
{
'ownerProgram': PPGP_ID,
'title': 'Projeto de Intervenção',
'cod': '09-2014',
'file': 'regimento_PROJETO-INTERVENCAO.docx',
'file': 'resolucao_PROJETO-INTERVENCAO.docx',
'insertedOn': new Date(2017, 04, 03, 09, 00, 00, 00),
'insertedBy': 'Marcell Guilherme Costa da Silva'
},
{
'ownerProgram': PPGP_ID,
'title': 'Aluno Especial',
'cod': '10-2014',
'file': 'regimento_ALUNO-ESPECIAL.docx',
'file': 'resolucao_ALUNO-ESPECIAL.docx',
'insertedOn': new Date(2017, 04, 03, 09, 00, 00, 00),
'insertedBy': 'Marcell Guilherme Costa da Silva'
}
Expand Down

0 comments on commit 925ed42

Please sign in to comment.