mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
FIX: remove client side maximum filesize check
This commit is contained in:
@ -177,14 +177,6 @@ Discourse.Utilities = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// check file size
|
|
||||||
var fileSizeKB = file.size / 1024;
|
|
||||||
var maxSizeKB = 10 * 1024; // 10MB
|
|
||||||
if (fileSizeKB > maxSizeKB) {
|
|
||||||
bootbox.alert(I18n.t('post.errors.file_too_large', { max_size_kb: maxSizeKB }));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// everything went fine
|
// everything went fine
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
@ -510,12 +510,8 @@ email:
|
|||||||
short_email_length: 2800
|
short_email_length: 2800
|
||||||
|
|
||||||
files:
|
files:
|
||||||
max_image_size_kb:
|
max_image_size_kb: 3072
|
||||||
client: true
|
max_attachment_size_kb: 3072
|
||||||
default: 3072
|
|
||||||
max_attachment_size_kb:
|
|
||||||
client: true
|
|
||||||
default: 3072
|
|
||||||
authorized_extensions:
|
authorized_extensions:
|
||||||
client: true
|
client: true
|
||||||
default: 'jpg|jpeg|png|gif'
|
default: 'jpg|jpeg|png|gif'
|
||||||
|
@ -63,8 +63,6 @@ Discourse.SiteSettingsOriginal = {
|
|||||||
"default_code_lang":"lang-auto",
|
"default_code_lang":"lang-auto",
|
||||||
"autohighlight_all_code":false,
|
"autohighlight_all_code":false,
|
||||||
"email_in":false,
|
"email_in":false,
|
||||||
"max_image_size_kb":3072,
|
|
||||||
"max_attachment_size_kb":1024,
|
|
||||||
"authorized_extensions":".jpg|.jpeg|.png|.gif|.svg|.txt|.ico|.yml",
|
"authorized_extensions":".jpg|.jpeg|.png|.gif|.svg|.txt|.ico|.yml",
|
||||||
"max_image_width":690,
|
"max_image_width":690,
|
||||||
"max_image_height":500,
|
"max_image_height":500,
|
||||||
|
@ -51,16 +51,6 @@ test("ensures an authorized upload", function() {
|
|||||||
ok(bootbox.alert.calledWith(I18n.t('post.errors.upload_not_authorized', { authorized_extensions: extensions })));
|
ok(bootbox.alert.calledWith(I18n.t('post.errors.upload_not_authorized', { authorized_extensions: extensions })));
|
||||||
});
|
});
|
||||||
|
|
||||||
test("prevents files that are too big from being uploaded", function() {
|
|
||||||
Discourse.User.resetCurrent(Discourse.User.create());
|
|
||||||
var image = { name: "image.png", size: 11 * 1024 * 1024 };
|
|
||||||
Discourse.User.currentProp("trust_level", 1);
|
|
||||||
sandbox.stub(bootbox, "alert");
|
|
||||||
|
|
||||||
not(validUpload([image]));
|
|
||||||
ok(bootbox.alert.calledWith(I18n.t('post.errors.file_too_large', { max_size_kb: 10 * 1024 })));
|
|
||||||
});
|
|
||||||
|
|
||||||
var imageSize = 10 * 1024;
|
var imageSize = 10 * 1024;
|
||||||
|
|
||||||
var dummyBlob = function() {
|
var dummyBlob = function() {
|
||||||
@ -77,8 +67,6 @@ var dummyBlob = function() {
|
|||||||
test("allows valid uploads to go through", function() {
|
test("allows valid uploads to go through", function() {
|
||||||
Discourse.User.resetCurrent(Discourse.User.create());
|
Discourse.User.resetCurrent(Discourse.User.create());
|
||||||
Discourse.User.currentProp("trust_level", 1);
|
Discourse.User.currentProp("trust_level", 1);
|
||||||
Discourse.SiteSettings.max_image_size_kb = 15;
|
|
||||||
Discourse.SiteSettings.max_attachment_size_kb = 1;
|
|
||||||
sandbox.stub(bootbox, "alert");
|
sandbox.stub(bootbox, "alert");
|
||||||
|
|
||||||
// image
|
// image
|
||||||
|
Reference in New Issue
Block a user