Uploads: prevent submission of unfinished uploads

This commit is contained in:
nonamethanks
2021-07-22 15:40:25 +02:00
committed by evazion
parent 55d00fc40c
commit 7b817b0a30

View File

@@ -42,9 +42,12 @@ Upload.initialize_submit = function() {
Upload.validate_upload = function (e) {
var error_messages = [];
if (($("#upload_file").val() === "") && !/^https?:\/\//i.test($("#upload_source").val()) && $("#upload_md5_confirmation").val() === "") {
if (($("#upload_file").val() === undefined) && !/^https?:\/\/.+/i.test($("#upload_source").val()) && $("#upload_md5_confirmation").val() === "") {
error_messages.push("Must choose file or specify source");
}
else if ($(".dz-progress:visible").length) {
error_messages.push("File has not finished uploading yet")
}
if (!$("#upload_rating_s").prop("checked") && !$("#upload_rating_q").prop("checked") && !$("#upload_rating_e").prop("checked") &&
($("#upload_tag_string").val().search(/\brating:[sqe]/i) < 0)) {
error_messages.push("Must specify a rating");