Fix cli.py running in wrong working directory.

Previously, cli.py ran in <repo-root>/files. However, our relative
paths assume the working directory is <repo-root>. 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.
remotes/1693045480750635534/spooky-22
Snakes 2022-06-19 05:28:07 -04:00
parent 26686a65ec
commit 612fd44298
1 changed files with 7 additions and 0 deletions

View File

@ -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 <repo-root>/files, whereas our relative paths assume
# the WD is <repo-root>. 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