Skip to content

Commit

Permalink
attachement: Allow upload file max size setting
Browse files Browse the repository at this point in the history
Now, server admin can modify max upload file size limit.
Default size is 2Gb

application.conf
---
application.maxFileSize = 2147483454

See: yona github issue #104
  • Loading branch information
doortts committed Dec 14, 2016
1 parent daf5793 commit d2fbefb
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 52 deletions.
9 changes: 6 additions & 3 deletions app/assets/stylesheets/less/_yobiUI.less
Original file line number Diff line number Diff line change
Expand Up @@ -589,9 +589,12 @@ span.issue-label {
.toast {
position:relative;
display:inline-block;
width: 300px; height: 50px;
margin: 10px; padding: 10px;
outline:none; text-align: center;
width: 300px;
word-break: keep-all;
word-wrap: break-word;
margin: 10px;
padding: 10px;
outline:none;
font-weight: bold;

border: 2px solid @primary;
Expand Down
3 changes: 2 additions & 1 deletion app/views/common/scripts.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@
// yobi.Files
yobi.Files.init({
"sListURL" : "@routes.AttachmentApp.getFileList()",
"sUploadURL": "@routes.AttachmentApp.uploadFile()"
"sUploadURL": "@routes.AttachmentApp.uploadFile()",
"maxFileSize": "@play.Configuration.root().getLong("application.maxFileSize", 2147483454L)" // 2Gb
});

// ajax for issue link detail(ui.IssuePreview)
Expand Down
8 changes: 7 additions & 1 deletion conf/application.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -256,4 +256,10 @@ application.displayPrivateRepositories = false
#
github.allow.migration = false
github.client.id = "TYPE YOUR GITHUB CILENT ID"
github.client.secret = "TYPE YOUR GITHUB CILENT SECRET"
github.client.secret = "TYPE YOUR GITHUB CILENT SECRET"


# Attachment Upload File Size Limit
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 2,147,483,454 bytes = 2Gb
application.maxFileSize = 2147483454
9 changes: 6 additions & 3 deletions public/bootstrap/js/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/* ===================================================
* bootstrap-transition.js v2.3.1
* http://twitter.github.com/bootstrap/javascript.html#transitions
/*
* Yona, 21st Century Project Hosting SW
* <p>
* Copyright Yona & Yobi Authors & NAVER Corp.
* https://yona.io
*/rap/javascript.html#transitions
* ===================================================
* Copyright 2012 Twitter, Inc.
*
Expand Down
4 changes: 2 additions & 2 deletions public/javascripts/common/yobi.Files.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ yobi.Files = (function(){
&& (navigator.userAgent.indexOf("FireFox") === -1); // and not FireFox

// maximum filesize (<= 2,147,483,454 bytes = 2Gb)
htVar.nMaxFileSize = 2147483454;
htVar.nMaxFileSize = htOptions.maxFileSize || 2147483454;
}

/**
Expand Down Expand Up @@ -122,7 +122,7 @@ yobi.Files = (function(){
// check maximum filesize (<= 2,147,483,454 bytes) if available
if(oFile.size && oFile.size > htVar.nMaxFileSize){
return _onErrorSubmit(nSubmitId, {
"status" : 0,
"status" : humanize.filesize(oFile.size),
"statusText": Messages("error.toolargefile", humanize.filesize(htVar.nMaxFileSize))
}, sNamespace);
}
Expand Down
Loading

0 comments on commit d2fbefb

Please sign in to comment.