Skip to content

Commit

Permalink
Use FileUtils.mv instead of File.rename to handle cross-filesystem fi…
Browse files Browse the repository at this point in the history
…le manipulation (#19970)
  • Loading branch information
Thrillberg authored Dec 20, 2024
1 parent f7b06a8 commit 064a5bb
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require 'pdf_utilities/datestamp_pdf'
require 'fileutils'

module SimpleFormsApi
class PdfStamper
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 064a5bb

Please sign in to comment.