From 6eb54c6748803a6813dc2cb044193cc657562ee9 Mon Sep 17 00:00:00 2001
From: Harry Hughes <hugheshi@cardiff.ac.uk>
Date: Sun, 29 Jan 2023 17:11:29 +0000
Subject: [PATCH] Replace routes.py

---
 blog/routes.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/blog/routes.py b/blog/routes.py
index 2102601..a14298a 100644
--- a/blog/routes.py
+++ b/blog/routes.py
@@ -1,5 +1,6 @@
 from flask import render_template, url_for, request, redirect, flash, Response, send_file, abort
 from blog import app, db
+import os
 from blog.models import User, Post, Portfolio
 from blog.forms import RegistrationForm, LoginForm, UpdateAccountForm, PostForm
 from flask_login import login_user, logout_user, current_user
@@ -24,8 +25,8 @@ def cv():
 
 @app.route('/download')
 def download():
-  path = "static/pdf/cv.pdf"
-  return send_file(path, as_attachment=True)
+  file_path = os.path.join(os.getcwd(), "blog", "static", "pdf", "cv.pdf")
+  return send_file(file_path, as_attachment=True)
 
 @app.route("/blog")
 def blog():
-- 
GitLab