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 8eb41fd Detect rotation failure
8eb41fd is described below
commit 8eb41fdbc22f7a5f7f0e18154b79a31dd82f1dce
Author: Sebb <[email protected]>
AuthorDate: Tue Oct 23 23:55:04 2018 +0100
Detect rotation failure
---
www/secretary/workbench/views/actions/rotate-attachment.json.rb | 3 +++
1 file changed, 3 insertions(+)
diff --git a/www/secretary/workbench/views/actions/rotate-attachment.json.rb
b/www/secretary/workbench/views/actions/rotate-attachment.json.rb
index 185bf97..cbf831d 100644
--- a/www/secretary/workbench/views/actions/rotate-attachment.json.rb
+++ b/www/secretary/workbench/views/actions/rotate-attachment.json.rb
@@ -16,6 +16,9 @@ begin
Kernel.system 'pdftk', selected.path, 'cat', "1-end#{direction}", 'output',
output.path
+ # If output file is empty, then the command failed
+ raise "Failed to rotate #{@selected}" unless File.size? output
+
name = @selected.sub(/\.\w+$/, '') + '.pdf'
message.update_attachment @selected, content: output.read, name: name,