更新「lib/tasks/universal_table_tasks.rake」

fix File.exists?
This commit is contained in:
chiu 2023-04-08 14:42:56 +00:00
parent a55a23d0c1
commit 3459ddff38
1 changed files with 2 additions and 2 deletions

View File

@ -11,9 +11,9 @@ namespace :universal_table_tasks do
url = "http://#{args.url}"
xlsx = ac.render_to_string handlers: [:axlsx], formats: [:xlsx], template: "utable_export/export", locals: {table: table, site_in_use_locales: Site.first.in_use_locales, url: url}
dirname = "public/uploads/utable_export/#{id}"
FileUtils.mkdir_p(dirname) unless File.exists?(dirname)
FileUtils.mkdir_p(dirname) unless File.exist?(dirname)
f = "#{dirname}/#{table.title.gsub(/[ "'*@#$%^&()+=;:.,?>|\\\/<~_!:,、。!?;「」〈〉【】/]/,'')}.xlsx"
if File.exists?(f)
if File.exist?(f)
File.delete(f)
end
file = File.open(f, "w")