Fix bugs in the upload to images form (#1111)

* Fix formatting of the image subdir list for uploading

* Fix upload path
This commit is contained in:
Daniel Markstedt 2023-02-28 22:46:52 -08:00 committed by GitHub
parent 282c639438
commit ddf258db57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 5 deletions

View File

@ -15,11 +15,8 @@
<input type="radio" name="destination" id="disk_images" value="disk_images" checked="checked">
<label for="disk_images">{{ _("Disk Images") }}</label>
<select name="subdir" id="subdir">
<option value="">images/</option>
{% for subdir, group in formatted_image_files.items() %}
{% if subdir != "/" %}
<option value="{{subdir}}">images/{{subdir}}</option>
{% endif %}
<option value="{{subdir}}"{% if subdir == "images/" %} selected{% endif %}>{{subdir}}</option>
{% endfor %}
</select>
<input type="radio" name="destination" id="shared_files" value="shared_files">

View File

@ -990,7 +990,7 @@ def upload_file():
return make_response(auth["msg"], 403)
destination = request.form.get("destination")
subdir = request.form.get("subdir")
subdir = request.form.get("subdir").replace("images/", "", 1)
if destination == "disk_images":
safe_path = is_safe_path(Path(subdir))
if not safe_path["status"]: