mirror of
https://github.com/akuker/RASCSI.git
synced 2024-12-28 08:30:21 +00:00
Web UI: Remove workaround for listing English locale (#1291)
* Remove workaround for listing English locale * Use pathlib object to construct upload path
This commit is contained in:
parent
b69c039a0c
commit
cb6174fc1d
@ -21,7 +21,7 @@
|
||||
{% for dir in images_subdirs %}
|
||||
<option value="{{dir}}">{{dir}}</option>
|
||||
{% endfor %}
|
||||
<option value="/" selected>/</option>
|
||||
<option value="" selected>/</option>
|
||||
</select>
|
||||
{% if file_server_dir_exists %}
|
||||
<input type="radio" name="destination" id="shared_files" value="shared_files">
|
||||
@ -31,7 +31,7 @@
|
||||
{% for dir in shared_subdirs %}
|
||||
<option value="{{dir}}">{{dir}}</option>
|
||||
{% endfor %}
|
||||
<option value="/" selected>/</option>
|
||||
<option value="" selected>/</option>
|
||||
</select>
|
||||
{% endif %}
|
||||
<input type="radio" name="destination" id="piscsi_config" value="piscsi_config">
|
||||
|
@ -205,7 +205,7 @@ def get_supported_locales():
|
||||
"""
|
||||
locales = [
|
||||
{"language": x.language, "display_name": x.display_name}
|
||||
for x in [*BABEL.list_translations(), Locale("en")]
|
||||
for x in [*BABEL.list_translations()]
|
||||
]
|
||||
|
||||
return sorted(locales, key=lambda x: x["language"])
|
||||
@ -1038,14 +1038,14 @@ def upload_file():
|
||||
if not safe_path["status"]:
|
||||
return make_response(safe_path["msg"], 403)
|
||||
server_info = piscsi_cmd.get_server_info()
|
||||
destination_dir = server_info["image_dir"] + images_subdir
|
||||
destination_dir = Path(server_info["image_dir"]) / images_subdir
|
||||
elif destination == "shared_files":
|
||||
safe_path = is_safe_path(Path("." + shared_subdir))
|
||||
if not safe_path["status"]:
|
||||
return make_response(safe_path["msg"], 403)
|
||||
destination_dir = FILE_SERVER_DIR + shared_subdir
|
||||
destination_dir = Path(FILE_SERVER_DIR) / shared_subdir
|
||||
elif destination == "piscsi_config":
|
||||
destination_dir = CFG_DIR
|
||||
destination_dir = Path(CFG_DIR)
|
||||
else:
|
||||
return make_response(_("Unknown destination"), 403)
|
||||
|
||||
@ -1054,8 +1054,8 @@ def upload_file():
|
||||
file_name = secure_filename(file_object.filename)
|
||||
tmp_file_name = "__tmp_" + file_name
|
||||
|
||||
save_path = path.join(destination_dir, file_name)
|
||||
tmp_save_path = path.join(destination_dir, tmp_file_name)
|
||||
save_path = destination_dir / file_name
|
||||
tmp_save_path = destination_dir / tmp_file_name
|
||||
current_chunk = int(request.form["dzchunkindex"])
|
||||
|
||||
# Makes sure not to overwrite an existing file,
|
||||
|
@ -255,7 +255,7 @@ def test_upload_file(http_client, delete_file):
|
||||
|
||||
form_data = {
|
||||
"destination": "disk_images",
|
||||
"images_subdir": "/",
|
||||
"images_subdir": "",
|
||||
"dzuuid": str(uuid.uuid4()),
|
||||
"dzchunkindex": chunk_number,
|
||||
"dzchunksize": chunk_size,
|
||||
|
Loading…
Reference in New Issue
Block a user