Skip to content

Commit

Permalink
Update FillablePDF#save to use FileUtils.mv (#16)
Browse files Browse the repository at this point in the history
This is instead of File.rename, which can error out with
"Invalid cross-device link @ rb_file_s_rename" in e.g.
Docker containers.

Co-authored-by: mpd <[email protected]>
  • Loading branch information
xxx and mpd authored Dec 30, 2020
1 parent d30a304 commit 0bd5a6e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/fillable-pdf.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require_relative 'fillable-pdf/itext'
require_relative 'field'
require 'fileutils'
require 'securerandom'

class FillablePDF
Expand Down Expand Up @@ -158,7 +159,7 @@ def values
def save(flatten: false)
tmp_file = SecureRandom.uuid
save_as(tmp_file, flatten: flatten)
File.rename tmp_file, @file_path
FileUtils.mv tmp_file, @file_path
end

##
Expand Down

0 comments on commit 0bd5a6e

Please sign in to comment.