Remove file extension validation in upload form (#826)

* Remove file extension validation in upload form. Improve on the related help text.

* Split up image and archive file suffixes.
This commit is contained in:
Daniel Markstedt 2022-09-03 00:14:13 -07:00 committed by GitHub
parent 355b42703b
commit 2411afb2c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 8 deletions

View File

@ -156,6 +156,8 @@
<li>{{ _("Select a valid SCSI ID and <a href=\"%(url)s\">LUN</a> to attach to. Unless you know what you're doing, always use LUN 0.", url="https://en.wikipedia.org/wiki/Logical_unit_number") }} <li>{{ _("Select a valid SCSI ID and <a href=\"%(url)s\">LUN</a> to attach to. Unless you know what you're doing, always use LUN 0.", url="https://en.wikipedia.org/wiki/Logical_unit_number") }}
</li> </li>
<li>{{ _("If RaSCSI was unable to detect the media type associated with the image, you get to choose the type from the dropdown.") }}</li> <li>{{ _("If RaSCSI was unable to detect the media type associated with the image, you get to choose the type from the dropdown.") }}</li>
<li>{{ _("Recognized image file types: %(valid_image_suffixes)s", valid_image_suffixes=valid_image_suffixes) }}</li>
<li>{{ _("Recognized archive file types: %(ARCHIVE_FILE_SUFFIXES)s", ARCHIVE_FILE_SUFFIXES=ARCHIVE_FILE_SUFFIXES) }}</li>
</ul> </ul>
</details> </details>
@ -378,9 +380,9 @@
{{ _("Upload File") }} {{ _("Upload File") }}
</summary> </summary>
<ul> <ul>
<li>{{ _("Uploads file to <tt>%(directory)s</tt>. The largest file size accepted is %(max_file_size)s MB.", directory=base_dir, max_file_size=max_file_size) }}</li> <li>{{ _("Files are uploaded to <tt>%(directory)s</tt>.", directory=base_dir) }}</li>
<li>{{ _("For unrecognized file types, try renaming hard drive images to '.hds', CD-ROM images to '.iso', and removable drive images to '.hdr' before uploading.") }}</li> <li>{{ _("The largest file size accepted in this form is %(max_file_size)s MB. Use other file transfer means for larger files.", max_file_size=max_file_size) }}</li>
<li>{{ _("Recognized file types: %(valid_file_suffix)s", valid_file_suffix=valid_file_suffix) }}</li> <li>{{ _("File uploads will progress only if you stay on this page. If you navigate away before the transfer is completed, you will end up with an incomplete file.") }}</li>
</ul> </ul>
</details> </details>
@ -394,7 +396,6 @@
<script type="application/javascript"> <script type="application/javascript">
Dropzone.options.dropper = { Dropzone.options.dropper = {
paramName: 'file', paramName: 'file',
acceptedFiles: '{{ valid_file_suffix }}',
chunking: true, chunking: true,
forceChunking: true, forceChunking: true,
url: '/files/upload', url: '/files/upload',

View File

@ -133,13 +133,13 @@ def index():
scsi_ids, recommended_id = get_valid_scsi_ids(devices["device_list"], reserved_scsi_ids) scsi_ids, recommended_id = get_valid_scsi_ids(devices["device_list"], reserved_scsi_ids)
formatted_devices = sort_and_format_devices(devices["device_list"]) formatted_devices = sort_and_format_devices(devices["device_list"])
valid_file_suffix = "." + ", .".join( valid_image_suffixes = "." + ", .".join(
server_info["sahd"] + server_info["sahd"] +
server_info["schd"] + server_info["schd"] +
server_info["scrm"] + server_info["scrm"] +
server_info["scmo"] + server_info["scmo"] +
server_info["sccd"] + server_info["sccd"]
ARCHIVE_FILE_SUFFIXES) )
if "username" in session: if "username" in session:
username = session["username"] username = session["username"]
@ -175,13 +175,14 @@ def index():
netinfo=ractl_cmd.get_network_info(), netinfo=ractl_cmd.get_network_info(),
device_types=device_types, device_types=device_types,
free_disk=int(sys_cmd.disk_space()["free"] / 1024 / 1024), free_disk=int(sys_cmd.disk_space()["free"] / 1024 / 1024),
valid_file_suffix=valid_file_suffix, valid_image_suffixes=valid_image_suffixes,
cdrom_file_suffix=tuple(server_info["sccd"]), cdrom_file_suffix=tuple(server_info["sccd"]),
removable_file_suffix=tuple(server_info["scrm"]), removable_file_suffix=tuple(server_info["scrm"]),
mo_file_suffix=tuple(server_info["scmo"]), mo_file_suffix=tuple(server_info["scmo"]),
username=username, username=username,
auth_active=auth_active(AUTH_GROUP)["status"], auth_active=auth_active(AUTH_GROUP)["status"],
PROPERTIES_SUFFIX=PROPERTIES_SUFFIX, PROPERTIES_SUFFIX=PROPERTIES_SUFFIX,
ARCHIVE_FILE_SUFFIXES="." + ", .".join(ARCHIVE_FILE_SUFFIXES),
REMOVABLE_DEVICE_TYPES=ractl_cmd.get_removable_device_types(), REMOVABLE_DEVICE_TYPES=ractl_cmd.get_removable_device_types(),
DISK_DEVICE_TYPES=ractl_cmd.get_disk_device_types(), DISK_DEVICE_TYPES=ractl_cmd.get_disk_device_types(),
PERIPHERAL_DEVICE_TYPES=ractl_cmd.get_peripheral_device_types(), PERIPHERAL_DEVICE_TYPES=ractl_cmd.get_peripheral_device_types(),