From 18e73f6e9da142ff92785ead146484be0499437c Mon Sep 17 00:00:00 2001 From: LuanGB Date: Tue, 5 Sep 2023 11:46:37 -0300 Subject: [PATCH 1/2] fix: check if file exists before deleting --- lib/wicked_pdf.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/wicked_pdf.rb b/lib/wicked_pdf.rb index 15503275..57948ba1 100644 --- a/lib/wicked_pdf.rb +++ b/lib/wicked_pdf.rb @@ -109,6 +109,9 @@ def option_parser def clean_temp_files return unless option_parser.hf_tempfiles.present? - option_parser.hf_tempfiles.each { |file| File.delete(file) } + option_parser.hf_tempfiles.each do |file| + next unless File.exists?(file.path) + File.delete(file) + end end end From 0e47313a9978380de090f2ccdd19e015102b5b69 Mon Sep 17 00:00:00 2001 From: LuanGB Date: Tue, 5 Sep 2023 11:52:21 -0300 Subject: [PATCH 2/2] fix rubocop --- lib/wicked_pdf.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/wicked_pdf.rb b/lib/wicked_pdf.rb index 57948ba1..a4d5e796 100644 --- a/lib/wicked_pdf.rb +++ b/lib/wicked_pdf.rb @@ -110,7 +110,8 @@ def clean_temp_files return unless option_parser.hf_tempfiles.present? option_parser.hf_tempfiles.each do |file| - next unless File.exists?(file.path) + next unless File.exist?(file.path) + File.delete(file) end end