Skip to content
Snippets Groups Projects
Commit 0f91fbca authored by Felix Chadwick-Smith's avatar Felix Chadwick-Smith
Browse files

Merge branch 'master' into 'main'

Master

See merge request !20
parents ebe56c51 7b960ca3
No related branches found
No related tags found
1 merge request!20Master
...@@ -76,9 +76,10 @@ def download_cv(): ...@@ -76,9 +76,10 @@ def download_cv():
@app.route('/download_assessment/<filename>') @app.route('/download_assessment/<filename>')
def download_assessment(filename): def download_assessment(filename):
try: try:
file_path = f'static/{filename}' file_path = os.path.join('static', filename)
print(f"Attempting to serve file: {file_path}") print(f"Attempting to serve file: {file_path}")
return send_from_directory('static', filename, as_attachment=True)
return send_from_directory(app.static_folder, filename, as_attachment=True)
except FileNotFoundError: except FileNotFoundError:
print(f"File not found: {file_path}") print(f"File not found: {file_path}")
abort(404) # Return a 404 Not Found error abort(404) # Return a 404 Not Found error
...@@ -86,8 +87,7 @@ def download_assessment(filename): ...@@ -86,8 +87,7 @@ def download_assessment(filename):
print(f"Error serving assessment file: {str(e)}") print(f"Error serving assessment file: {str(e)}")
current_app.logger.exception(f"Error serving assessment file: {str(e)}") current_app.logger.exception(f"Error serving assessment file: {str(e)}")
abort(500) abort(500)
if __name__ == '__main__': if __name__ == '__main__':
with app.app_context(): with app.app_context():
db.create_all() db.create_all()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment