mirror of https://gitlab.com/litecord/litecord.git
fix static file send
This commit is contained in:
parent
1111fffd3a
commit
a9c3537b88
|
|
@ -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("/")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue