combine chmod to prevent permission denied issues when chmod does not run

This commit is contained in:
Kyle Drake 2025-06-13 11:41:24 -05:00
parent e30e9eca7d
commit 343e85a3bc
2 changed files with 2 additions and 4 deletions

View file

@ -58,8 +58,7 @@ post '/site_files/create' do
end end
else else
file_path = current_site.files_path(name) file_path = current_site.files_path(name)
FileUtils.touch file_path File.open(file_path, 'a', 0640) {}
File.chmod 0640, file_path
site_file ||= SiteFile.new site_id: current_site.id, path: name site_file ||= SiteFile.new site_id: current_site.id, path: name

View file

@ -1973,8 +1973,7 @@ class Site < Sequel::Model
end end
end end
FileUtils.cp uploaded.path, path FileUtils.install uploaded.path, path, mode: 0640
File.chmod 0640, path
SiteChange.record self, relative_path if !opts[:new_install] && File.extname(relative_path).match(HTML_REGEX) SiteChange.record self, relative_path if !opts[:new_install] && File.extname(relative_path).match(HTML_REGEX)