don't fail on patch missing a Subject: line
This commit is contained in:
parent
4c772944d3
commit
91b965f264
|
@ -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;
|
||||
|
|
Reference in New Issue