Merge pull request #4865 from nonamethanks/fix-upload-form-submitting-early

This commit is contained in:
evazion
2021-09-08 20:30:04 -05:00

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");