Skip to content

Commit

Permalink
Merge pull request #1 from redknitin/master
Browse files Browse the repository at this point in the history
Syncing from original
  • Loading branch information
IlinDmitry authored Dec 11, 2017
2 parents db2b66a + ffd4545 commit 83ab846
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,9 @@ We use [SemVer](http://semver.org/) for versioning. For the versions available,

The following individuals contributed code to this project:

* [Ilin Dmitry](https://github.com/IlinDmitry)
* [Kevin Smith](https://github.com/kvsm)
* Nitin Reddy
* [Nitin Reddy](https://github.com/redknitin)
* _When we accept your pull request or patch, your name will appear here_

## License
Expand Down
1 change: 1 addition & 0 deletions app_config.defaults.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,5 @@ class AppConfig

UPLOAD_DIR = 'public/uploads'
UPLOAD_FILE_EXTS = ['.doc', '.docx', '.xls', '.xlsx', '.pdf', '.eml', '.jpg', '.png', '.jpeg', '.tif']
UPLOAD_MAX_SIZE = 2000000 #In bytes
end
1 change: 1 addition & 0 deletions helpers/appinit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ def initialize()

@uploaddir = (defined? AppConfig::UPLOAD_DIR != nil) ? AppConfig::UPLOAD_DIR : 'public/uploads'
@uploadfilter = ((defined? AppConfig::UPLOAD_FILE_EXTS != nil) && AppConfig::UPLOAD_FILE_EXTS != []) ? (AppConfig::UPLOAD_FILE_EXTS.map { |x| x.downcase }) : []
@uploadmaxsize = (defined? AppConfig::UPLOAD_MAX_SIZE != nil) && AppConfig::UPLOAD_MAX_SIZE > 0 ? AppConfig::UPLOAD_MAX_SIZE : -1
end
end
2 changes: 1 addition & 1 deletion routes/tickets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ class Helpdesk < Sinatra::Base
end

#File size limit check
if @params[:file][:tempfile].size > 2000000
if @uploadmaxsize != -1 && @params[:file][:tempfile].size > @uploadmaxsize
redirect '/ticket-detail/'+@params[:ticket]+'?msg=File: '+@params[:file][:filename]+' has exceeded the 2 MB file size limit.'
return
end
Expand Down

0 comments on commit 83ab846

Please sign in to comment.