mirror of
https://github.com/akuker/RASCSI.git
synced 2025-01-20 07:31:27 +00:00
Remove file type check since it happens after uploading has completed
This commit is contained in:
parent
ac97d4bbaa
commit
03e1a961f3
@ -126,7 +126,6 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<p><small>Supported file types: {{valid_file_suffix|string()}}</small></p>
|
|
||||||
|
|
||||||
<hr/>
|
<hr/>
|
||||||
<h2>Attach Ethernet Adapter</h2>
|
<h2>Attach Ethernet Adapter</h2>
|
||||||
@ -180,6 +179,7 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
<p><small>Supported file types: {{valid_file_suffix}}</small></p>
|
||||||
|
|
||||||
<hr/>
|
<hr/>
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ def index():
|
|||||||
running_env=running_env(),
|
running_env=running_env(),
|
||||||
server_info=server_info,
|
server_info=server_info,
|
||||||
netinfo=get_network_info(),
|
netinfo=get_network_info(),
|
||||||
valid_file_suffix=VALID_FILE_SUFFIX,
|
valid_file_suffix=", ".join(VALID_FILE_SUFFIX),
|
||||||
removable_device_types=REMOVABLE_DEVICE_TYPES,
|
removable_device_types=REMOVABLE_DEVICE_TYPES,
|
||||||
harddrive_file_suffix=HARDDRIVE_FILE_SUFFIX,
|
harddrive_file_suffix=HARDDRIVE_FILE_SUFFIX,
|
||||||
cdrom_file_suffix=CDROM_FILE_SUFFIX,
|
cdrom_file_suffix=CDROM_FILE_SUFFIX,
|
||||||
@ -488,19 +488,16 @@ def upload_file():
|
|||||||
from os import path
|
from os import path
|
||||||
filename = secure_filename(f.filename)
|
filename = secure_filename(f.filename)
|
||||||
filepath = path.join(app.config["UPLOAD_FOLDER"], filename)
|
filepath = path.join(app.config["UPLOAD_FOLDER"], filename)
|
||||||
if not filename.lower().endswith(VALID_FILE_SUFFIX):
|
|
||||||
flash("Not a file format RaSCSI recognizes. Needs to be one of:", "error")
|
|
||||||
flash(f"{VALID_FILE_SUFFIX}", "error")
|
|
||||||
return redirect(url_for("index"))
|
|
||||||
if path.isfile(filepath):
|
if path.isfile(filepath):
|
||||||
flash(f"{filename} already exists.", "error")
|
flash(f"{filename} already exists.", "error")
|
||||||
return redirect(url_for("index"))
|
return redirect(url_for("index"))
|
||||||
|
else:
|
||||||
try:
|
try:
|
||||||
f.save(filepath)
|
f.save(filepath)
|
||||||
flash(f"File {filename} successfully uploaded to {base_dir} !")
|
flash(f"File {filename} successfully uploaded to {base_dir} !")
|
||||||
return redirect(url_for("index"))
|
return redirect(url_for("index"))
|
||||||
except error as e:
|
except:
|
||||||
flash(f"Failed to upload {filename}: {str(e)}")
|
flash(f"Failed to upload {filename} !")
|
||||||
return redirect(url_for("index"))
|
return redirect(url_for("index"))
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user