diff --git a/app/site_files.rb b/app/site_files.rb index 33586e8b..56ce6f92 100644 --- a/app/site_files.rb +++ b/app/site_files.rb @@ -58,8 +58,7 @@ post '/site_files/create' do end else file_path = current_site.files_path(name) - FileUtils.touch file_path - File.chmod 0640, file_path + File.open(file_path, 'a', 0640) {} site_file ||= SiteFile.new site_id: current_site.id, path: name diff --git a/models/site.rb b/models/site.rb index 4790e80e..0d560af6 100644 --- a/models/site.rb +++ b/models/site.rb @@ -1973,8 +1973,7 @@ class Site < Sequel::Model end end - FileUtils.cp uploaded.path, path - File.chmod 0640, path + FileUtils.install uploaded.path, path, mode: 0640 SiteChange.record self, relative_path if !opts[:new_install] && File.extname(relative_path).match(HTML_REGEX)