fix static file send

This commit is contained in:
Luna 2022-08-13 17:04:13 -03:00
parent 1111fffd3a
commit a9c3537b88
1 changed files with 5 additions and 2 deletions

View File

@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
""" """
from quart import Blueprint, current_app as app, render_template_string from quart import Blueprint, current_app as app, render_template_string, send_file
from pathlib import Path from pathlib import Path
bp = Blueprint("static", __name__) bp = Blueprint("static", __name__)
@ -30,7 +30,10 @@ async def static_pages(path):
return "no", 404 return "no", 404
static_path = Path.cwd() / Path("static") / path static_path = Path.cwd() / Path("static") / path
return await app.send_static_file(str(static_path)) if static_path.exists():
return await send_file(static_path)
else:
return "not found", 404
@bp.route("/") @bp.route("/")