mirror of
https://github.com/discourse/discourse.git
synced 2025-03-09 14:34:35 +00:00
FIX: remove client side maximum filesize check
This commit is contained in:
parent
c27cefd595
commit
07d6bb8d31
@ -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
|
||||
return true;
|
||||
},
|
||||
|
@ -510,12 +510,8 @@ email:
|
||||
short_email_length: 2800
|
||||
|
||||
files:
|
||||
max_image_size_kb:
|
||||
client: true
|
||||
default: 3072
|
||||
max_attachment_size_kb:
|
||||
client: true
|
||||
default: 3072
|
||||
max_image_size_kb: 3072
|
||||
max_attachment_size_kb: 3072
|
||||
authorized_extensions:
|
||||
client: true
|
||||
default: 'jpg|jpeg|png|gif'
|
||||
|
@ -63,8 +63,6 @@ Discourse.SiteSettingsOriginal = {
|
||||
"default_code_lang":"lang-auto",
|
||||
"autohighlight_all_code":false,
|
||||
"email_in":false,
|
||||
"max_image_size_kb":3072,
|
||||
"max_attachment_size_kb":1024,
|
||||
"authorized_extensions":".jpg|.jpeg|.png|.gif|.svg|.txt|.ico|.yml",
|
||||
"max_image_width":690,
|
||||
"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 })));
|
||||
});
|
||||
|
||||
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 dummyBlob = function() {
|
||||
@ -77,8 +67,6 @@ var dummyBlob = function() {
|
||||
test("allows valid uploads to go through", function() {
|
||||
Discourse.User.resetCurrent(Discourse.User.create());
|
||||
Discourse.User.currentProp("trust_level", 1);
|
||||
Discourse.SiteSettings.max_image_size_kb = 15;
|
||||
Discourse.SiteSettings.max_attachment_size_kb = 1;
|
||||
sandbox.stub(bootbox, "alert");
|
||||
|
||||
// image
|
||||
|
Loading…
x
Reference in New Issue
Block a user