1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-12-18 22:20:30 +00:00

Improved pathchooser

This commit is contained in:
Ozzie Isaacs 2023-07-09 10:00:54 +02:00
parent 63b7d70f33
commit 3f5583017f

View File

@ -33,6 +33,7 @@ from functools import wraps
from urllib.parse import urlparse from urllib.parse import urlparse
from flask import Blueprint, flash, redirect, url_for, abort, request, make_response, send_from_directory, g, Response from flask import Blueprint, flash, redirect, url_for, abort, request, make_response, send_from_directory, g, Response
from flask import Markup
from flask_login import login_required, current_user, logout_user from flask_login import login_required, current_user, logout_user
from flask_babel import gettext as _ from flask_babel import gettext as _
from flask_babel import get_locale, format_time, format_datetime, format_timedelta from flask_babel import get_locale, format_time, format_datetime, format_timedelta
@ -1035,7 +1036,8 @@ def pathchooser():
for f in folders: for f in folders:
try: try:
data = {"name": f, "fullpath": os.path.join(cwd, f)} sanitized_f = str(Markup.escape(f))
data = {"name": sanitized_f, "fullpath": os.path.join(cwd, sanitized_f)}
data["sort"] = data["fullpath"].lower() data["sort"] = data["fullpath"].lower()
except Exception: except Exception:
continue continue