Skip to content

Commit ece11e3

Browse files
committed
Slightly clean up patch detection code
Makes the code for detecting if an attachment is a patch or have a file extension indicating that it's a patch slightly nicer.
1 parent 4c8ed2d commit ece11e3

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

app/models/attachment.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ class Attachment < ApplicationRecord
66
after_destroy :update_topic_has_attachments
77

88
def patch?
9-
file_name&.ends_with?(".patch") || file_name&.ends_with?(".diff") || patch_content?
9+
patch_extension? || patch_content?
1010
end
1111

1212
def patch_extension?
13-
file_name&.ends_with?(".patch") || file_name&.ends_with?(".diff")
13+
file_name&.ends_with?('.patch', '.diff')
1414
end
1515

1616
def decoded_body

0 commit comments

Comments
 (0)