From 612fd44298cf45e3bf5f17dd8455a2881a6016f9 Mon Sep 17 00:00:00 2001 From: TLSM Date: Sun, 19 Jun 2022 05:28:07 -0400 Subject: [PATCH] Fix cli.py running in wrong working directory. Previously, cli.py ran in /files. However, our relative paths assume the working directory is . This resulted in sanitize.render_emoji L153 to improperly return false when checking for the presence of 'files/assets/images/emojis/{emoji}.webp', leading to emojis in notifications sent by cli.py-invoked tasks to not be rendered to HTML. --- files/cli.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/files/cli.py b/files/cli.py index b16c34d98..6f5f7c38f 100644 --- a/files/cli.py +++ b/files/cli.py @@ -2,6 +2,13 @@ from .__main__ import app, db_session, cache from flask import g import files.helpers.cron +import os +from pathlib import Path + +# cli.py runs in /files, whereas our relative paths assume +# the WD is . NOTE: Change this if cli.py is ever moved. +os.chdir(Path(__file__).parent.parent) + #from flask_migrate import Migrate #from flask_sqlalchemy import SQLAlchemy #import files.classes