From 064a5bb7006fe3a8d50d9107ee89ac7dcd642f63 Mon Sep 17 00:00:00 2001 From: Eric Tillberg <Thrillberg@users.noreply.github.com> Date: Fri, 20 Dec 2024 13:39:03 -0500 Subject: [PATCH] Use FileUtils.mv instead of File.rename to handle cross-filesystem file manipulation (#19970) --- .../app/services/simple_forms_api/pdf_stamper.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/simple_forms_api/app/services/simple_forms_api/pdf_stamper.rb b/modules/simple_forms_api/app/services/simple_forms_api/pdf_stamper.rb index fe34bddc827..75ec467feed 100644 --- a/modules/simple_forms_api/app/services/simple_forms_api/pdf_stamper.rb +++ b/modules/simple_forms_api/app/services/simple_forms_api/pdf_stamper.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require 'pdf_utilities/datestamp_pdf' +require 'fileutils' module SimpleFormsApi class PdfStamper @@ -64,7 +65,7 @@ def stamp_specified_page(desired_stamp) def stamp_all_pages(desired_stamp, append_to_stamp: nil) current_file_path = call_datestamp_pdf(desired_stamp[:coords], desired_stamp[:text], append_to_stamp) - File.rename(current_file_path, stamped_template_path) + FileUtils.mv(current_file_path, stamped_template_path) end def verified_multistamp(stamp, page_configuration) @@ -93,7 +94,7 @@ def perform_multistamp(stamp_path) def multistamp_cleanup(out_path) Common::FileHelpers.delete_file_if_exists(stamped_template_path) - File.rename(out_path, stamped_template_path) + FileUtils.mv(out_path, stamped_template_path) end def verify