From 91b965f2644a5be4a39650db0099c89c45ca0842 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Fri, 15 Jul 2016 09:51:57 +0200 Subject: [PATCH] don't fail on patch missing a Subject: line --- lib/attachments_controller_patch.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/attachments_controller_patch.rb b/lib/attachments_controller_patch.rb index f5240be..0737f73 100644 --- a/lib/attachments_controller_patch.rb +++ b/lib/attachments_controller_patch.rb @@ -8,7 +8,7 @@ module AttachmentsControllerPatch @diff = File.new(@attachment.diskfile, "rb").read @diff_type = params[:type] || User.current.pref[:diff_type] || 'inline' @diff_type = 'inline' unless %w(inline sbs).include?(@diff_type) - if (@diff.start_with?("From")) + if (@diff.start_with?("From") and @diff.match(/(Subject.*)^---$/m)) @diff_format_patch = @diff.match(/(Subject.*)^---$/m)[0].sub(/^---$/m, '').force_encoding('UTF-8'); else @diff_format_patch = nil;