Skip to content

Commit c988e78

Browse files
committed
IMPROVE: use mini-mime to reduce dependency complexity
1 parent 0ad8770 commit c988e78

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

lib/discourse_chatbot/functions/paint_edit_function.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# frozen_string_literal: true
22

33
require_relative '../function'
4-
require 'mime/types'
54

65
module DiscourseChatbot
76
class PaintEditFunction < Function
@@ -66,11 +65,10 @@ def process(args, opts)
6665
file_path = path = Discourse.store.path_for(last_image_upload)
6766
base64_encoded_data = Base64.strict_encode64(File.read(file_path))
6867

69-
7068
file_path = Discourse.store.path_for(last_image_upload)
7169
extension = last_image_upload.extension
72-
mime_type = ::MIME::Types.type_for(extension).first.to_s
73-
70+
mime_type = MiniMime.lookup_by_extension(extension).content_type
71+
7472
f = Tempfile.new(["e1_image", ".#{extension}"])
7573
f.binmode
7674
f.write(File.binread(file_path))

plugin.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
# authors: merefield
66
# url: https://github.com/merefield/discourse-chatbot
77

8-
gem 'mime-types-data', '3.2025.0617', { require: false }
9-
gem 'mime-types', '3.7.0', { require: false }
108
gem 'multipart-post', '2.4.0', { require: false }
119
gem 'faraday-multipart', '1.0.4', { require: false }
1210
gem 'event_stream_parser', '1.0.0', { require: false }

0 commit comments

Comments
 (0)