Skip to content

Commit

Permalink
[ME-3276] feat : adding pkcs8 content type
Browse files Browse the repository at this point in the history
  • Loading branch information
Yousif-Ahmed committed Nov 26, 2023
1 parent 486d9df commit c917d68
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/paperclip/content_type_detector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def calculated_type_matches
end

def type_from_file_contents
certificate_type || type_from_file_command
(certificate_type || pkcs8_type || type_from_file_command)
rescue Errno::ENOENT => e
Paperclip.log("Error while determining content type: #{e}")
SENSIBLE_DEFAULT
Expand All @@ -76,5 +76,11 @@ def certificate_type
'application/x-x509-ca-cert'
rescue StandardError
end

def pkcs8_type
key = OpenSSL::PKey.read(File.read(@filename))

Check warning on line 81 in lib/paperclip/content_type_detector.rb

View check run for this annotation

sonarqube-instabug / paperclip Sonarqube Results

lib/paperclip/content_type_detector.rb#L81

Remove this unused "key" local variable.
'application/pkcs8'
rescue StandardError
end
end
end

0 comments on commit c917d68

Please sign in to comment.