You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2021/11/04 12:17:15 UTC
[whimsy] branch master updated: Oops TempFile => Tempfile
This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new ed7c5f8 Oops TempFile => Tempfile
ed7c5f8 is described below
commit ed7c5f8944d0be8cfbab5e8df9a8f774252cf15e
Author: Sebb <se...@apache.org>
AuthorDate: Thu Nov 4 12:17:08 2021 +0000
Oops TempFile => Tempfile
---
www/secretary/workbench/models/attachment.rb | 8 ++++----
www/secretary/workbench/views/actions/drop.json.rb | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/www/secretary/workbench/models/attachment.rb b/www/secretary/workbench/models/attachment.rb
index 5dea86e..525bee7 100644
--- a/www/secretary/workbench/models/attachment.rb
+++ b/www/secretary/workbench/models/attachment.rb
@@ -53,7 +53,7 @@ class Attachment
# Warning: if the reference count goes to 0, the file may be deleted
# so calling code must retain the reference until done.
def as_file
- file = TempFile.new([safe_name, '.pdf'], encoding: Encoding::BINARY)
+ file = Tempfile.new([safe_name, '.pdf'], encoding: Encoding::BINARY)
file.write(body)
file.rewind
file
@@ -63,14 +63,14 @@ class Attachment
ext = File.extname(name).downcase
ext = '.pdf' if content_type.end_with? '/pdf'
- file = TempFile.new([safe_name, ext], encoding: Encoding::BINARY)
+ file = Tempfile.new([safe_name, ext], encoding: Encoding::BINARY)
file.write(body)
file.rewind
return file if ext == '.pdf'
if IMAGE_TYPES.include? ext or content_type.start_with? 'image/'
- pdf = TempFile.new([safe_name, '.pdf'], encoding: Encoding::BINARY)
+ pdf = Tempfile.new([safe_name, '.pdf'], encoding: Encoding::BINARY)
img2pdf = File.expand_path('../img2pdf', __dir__)
_stdout, stderr, status = Open3.capture3 img2pdf, '--output', pdf.path,
file.path
@@ -79,7 +79,7 @@ class Attachment
# use imagemagick to remove the alpha channel and try again.
unless status.exitstatus == 0
if stderr.include? 'remove the alpha channel'
- tmppng = TempFile.new([safe_name, '.png'], encoding: Encoding::BINARY)
+ tmppng = Tempfile.new([safe_name, '.png'], encoding: Encoding::BINARY)
system 'convert', file.path, '-background', 'white', '-alpha',
'remove', '-alpha', 'off', tmppng.path
diff --git a/www/secretary/workbench/views/actions/drop.json.rb b/www/secretary/workbench/views/actions/drop.json.rb
index 0bd9e15..89c9fb8 100644
--- a/www/secretary/workbench/views/actions/drop.json.rb
+++ b/www/secretary/workbench/views/actions/drop.json.rb
@@ -10,7 +10,7 @@ begin
# binary encoding was used by the SafeTempFile class, now removed
# It may no longer be necessary, but it probably does no harm
- output = TempFile.new('output', encoding: Encoding::BINARY)
+ output = Tempfile.new('output', encoding: Encoding::BINARY)
Kernel.system 'pdfunite', target.path, source.path, output.path