mirror of
https://github.com/neocities/neocities.git
synced 2025-06-19 10:50:34 +02:00
Fix file perms
This commit is contained in:
parent
7c9f1511bf
commit
5a990ff591
1 changed files with 4 additions and 1 deletions
5
app.rb
5
app.rb
|
@ -132,7 +132,10 @@ post '/site_files/upload' do
|
||||||
|
|
||||||
sanitized_filename = params[:newfile][:filename].gsub(/[^a-zA-Z_\-.]/, '')
|
sanitized_filename = params[:newfile][:filename].gsub(/[^a-zA-Z_\-.]/, '')
|
||||||
|
|
||||||
FileUtils.mv params[:newfile][:tempfile].path, File.join(site_base_path(current_site.username), sanitized_filename)
|
dest_path = File.join(site_base_path(current_site.username), sanitized_filename)
|
||||||
|
FileUtils.mv params[:newfile][:tempfile].path, dest_path
|
||||||
|
File.chmod(0640, dest_path) if self.class.production?
|
||||||
|
|
||||||
flash[:success] = "Successfully uploaded file #{sanitized_filename}."
|
flash[:success] = "Successfully uploaded file #{sanitized_filename}."
|
||||||
redirect '/dashboard'
|
redirect '/dashboard'
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue