mirror of
https://github.com/onionshare/onionshare.git
synced 2025-04-20 23:46:35 -04:00
Use importlib.metadata.version('flask') to detect Flask version
This commit is contained in:
parent
303c83604c
commit
ea34d32406
@ -17,6 +17,7 @@ GNU General Public License for more details.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""
|
||||
import importlib
|
||||
import logging
|
||||
import mimetypes
|
||||
import os
|
||||
@ -34,7 +35,6 @@ from flask import (
|
||||
abort,
|
||||
make_response,
|
||||
send_file,
|
||||
__version__ as flask_version,
|
||||
)
|
||||
from flask_compress import Compress
|
||||
from flask_socketio import SocketIO
|
||||
@ -138,6 +138,7 @@ class Web:
|
||||
# by default. To prevent content injection through template variables in
|
||||
# earlier versions of Flask, we force autoescaping in the Jinja2 template
|
||||
# engine if we detect a Flask version with insecure default behavior.
|
||||
flask_version = importlib.metadata.version("flask")
|
||||
if Version(flask_version) < Version("0.11"):
|
||||
# Monkey-patch in the fix from https://github.com/pallets/flask/commit/99c99c4c16b1327288fd76c44bc8635a1de452bc
|
||||
Flask.select_jinja_autoescape = self._safe_select_jinja_autoescape
|
||||
|
Loading…
x
Reference in New Issue
Block a user