mini_mime 1.1.2 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +18 -7
- data/.github/workflows/db.yml +1 -1
- data/CHANGELOG +8 -0
- data/lib/db/content_type_mime.db +2 -1
- data/lib/db/ext_mime.db +4 -3
- data/lib/mini_mime/version.rb +1 -1
- data/lib/mini_mime.rb +34 -15
- data/mini_mime.gemspec +3 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3106a12fa7abf2937ee5a081fe4ea70ba5b4fa7f63aa5ee9cf084c487bc92a64
|
4
|
+
data.tar.gz: dbf9c1dddd1fbc5b189e008aec2bdea0b89e87247f1a018638b79ed518ea3b96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bff186a11b2a3b60b14770eb3b40847463da24d9f971f5a52a865a742f8922697e48558404f5890ab25296c635386ce9cbf2b5c60c2931d1f4dcb7b9cec476c9
|
7
|
+
data.tar.gz: e344e520299cba8a3635c84af1dc1fde1831aeba4613b4b19f32fef0994cff0f7b9c7b04dc4d5724fa95fc6b052d6bc180e54010fbecbfcdac9cd1935bdb50ed
|
data/.github/workflows/ci.yml
CHANGED
@@ -4,31 +4,42 @@ on:
|
|
4
4
|
pull_request:
|
5
5
|
push:
|
6
6
|
branches:
|
7
|
-
-
|
7
|
+
- main
|
8
8
|
|
9
9
|
jobs:
|
10
10
|
build:
|
11
|
-
runs-on:
|
12
|
-
name: "Ruby ${{ matrix.ruby }} / Failure allowed: ${{ matrix.experimental }}"
|
11
|
+
runs-on: ${{ matrix.os }}-latest
|
12
|
+
name: "Ruby ${{ matrix.ruby }} / ${{ matrix.os }} / Failure allowed: ${{ matrix.experimental }}"
|
13
13
|
continue-on-error: ${{ matrix.experimental }}
|
14
|
+
timeout-minutes: 5
|
15
|
+
|
14
16
|
strategy:
|
15
17
|
fail-fast: false
|
16
18
|
matrix:
|
17
|
-
|
19
|
+
os: ["ubuntu"]
|
20
|
+
ruby: ["2.6", "2.7", "3.0", "3.1", "3.2"]
|
18
21
|
experimental: [false]
|
19
22
|
include:
|
23
|
+
- ruby: "3.2"
|
24
|
+
os: "windows"
|
25
|
+
experimental: false
|
20
26
|
- ruby: "ruby-head"
|
27
|
+
os: "ubuntu"
|
21
28
|
experimental: true
|
22
29
|
- ruby: "truffleruby-head"
|
30
|
+
os: "ubuntu"
|
23
31
|
experimental: true
|
24
32
|
- ruby: "jruby-head"
|
33
|
+
os: "ubuntu"
|
25
34
|
experimental: true
|
26
|
-
- ruby: "jruby-9.
|
35
|
+
- ruby: "jruby-9.3.9.0"
|
36
|
+
os: "ubuntu"
|
27
37
|
experimental: true
|
28
|
-
- ruby: "jruby-9.
|
38
|
+
- ruby: "jruby-9.4.0.0"
|
39
|
+
os: "ubuntu"
|
29
40
|
experimental: true
|
30
41
|
steps:
|
31
|
-
- uses: actions/checkout@
|
42
|
+
- uses: actions/checkout@v3
|
32
43
|
- uses: ruby/setup-ruby@v1
|
33
44
|
with:
|
34
45
|
ruby-version: ${{ matrix.ruby }}
|
data/.github/workflows/db.yml
CHANGED
data/CHANGELOG
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
08-08-2023
|
2
|
+
- Version 1.1.4
|
3
|
+
- Version 1.1.3 had issues on Windows which does not support pread, added a polyfill
|
4
|
+
|
5
|
+
04-08-2023
|
6
|
+
- Version 1.1.3
|
7
|
+
- Added fork safety by migrating from seek+read to pread
|
8
|
+
|
1
9
|
11-10-2021
|
2
10
|
- Version 1.1.2
|
3
11
|
- update mime types from upstream
|
data/lib/db/content_type_mime.db
CHANGED
@@ -692,6 +692,7 @@ ttf font/ttf
|
|
692
692
|
woff font/woff base64
|
693
693
|
woff2 font/woff2 base64
|
694
694
|
avif image/avif base64
|
695
|
+
bmp image/bmp base64
|
695
696
|
cgm image/cgm base64
|
696
697
|
g3 image/g3fax base64
|
697
698
|
gif image/gif base64
|
@@ -731,7 +732,6 @@ xif image/vnd.xiff
|
|
731
732
|
webp image/webp base64
|
732
733
|
3ds image/x-3ds base64
|
733
734
|
dng image/x-adobe-dng base64
|
734
|
-
bmp image/x-bmp base64
|
735
735
|
cr2 image/x-canon-cr2 base64
|
736
736
|
crw image/x-canon-crw base64
|
737
737
|
ras image/x-cmu-raster base64
|
@@ -787,6 +787,7 @@ ics text/calendar
|
|
787
787
|
css text/css 8bit
|
788
788
|
csv text/csv 8bit
|
789
789
|
html text/html 8bit
|
790
|
+
js text/javascript quoted-printable
|
790
791
|
markdown text/markdown quoted-printable
|
791
792
|
n3 text/n3 quoted-printable
|
792
793
|
txt text/plain quoted-printable
|
data/lib/db/ext_mime.db
CHANGED
@@ -70,7 +70,7 @@ blb application/x-blorb
|
|
70
70
|
bleep application/x-bleeper base64
|
71
71
|
blorb application/x-blorb base64
|
72
72
|
bmi application/vnd.bmi base64
|
73
|
-
bmp image/
|
73
|
+
bmp image/bmp base64
|
74
74
|
book application/vnd.framemaker base64
|
75
75
|
box application/vnd.previewsystems.box base64
|
76
76
|
boz application/x-bzip2 base64
|
@@ -408,6 +408,7 @@ jad text/vnd.sun.j2me.app-descriptor
|
|
408
408
|
jam application/vnd.jam base64
|
409
409
|
jar application/java-archive base64
|
410
410
|
java text/x-java-source quoted-printable
|
411
|
+
jfif image/jpeg base64
|
411
412
|
jisp application/vnd.jisp base64
|
412
413
|
jlt application/vnd.hp-jlyt base64
|
413
414
|
jnlp application/x-java-jnlp-file base64
|
@@ -422,7 +423,7 @@ jpgm image/jpm
|
|
422
423
|
jpgv video/JPEG base64
|
423
424
|
jpm image/jpm base64
|
424
425
|
jpx image/jpx base64
|
425
|
-
js
|
426
|
+
js text/javascript quoted-printable
|
426
427
|
json application/json 8bit
|
427
428
|
jsonml application/jsonml+json base64
|
428
429
|
k25 image/x-kodak-k25 base64
|
@@ -521,7 +522,7 @@ mj2 video/MJ2
|
|
521
522
|
mjp2 video/MJ2 base64
|
522
523
|
mjpeg video/x-motion-jpeg base64
|
523
524
|
mjpg video/x-motion-jpeg base64
|
524
|
-
mjs
|
525
|
+
mjs text/javascript quoted-printable
|
525
526
|
mk3d video/x-matroska base64
|
526
527
|
mka audio/x-matroska base64
|
527
528
|
mkd text/markdown quoted-printable
|
data/lib/mini_mime/version.rb
CHANGED
data/lib/mini_mime.rb
CHANGED
@@ -50,8 +50,6 @@ module MiniMime
|
|
50
50
|
end
|
51
51
|
|
52
52
|
class Db
|
53
|
-
LOCK = Mutex.new
|
54
|
-
|
55
53
|
def self.lookup_by_filename(filename)
|
56
54
|
extension = File.extname(filename)
|
57
55
|
return if extension.empty?
|
@@ -60,18 +58,14 @@ module MiniMime
|
|
60
58
|
end
|
61
59
|
|
62
60
|
def self.lookup_by_extension(extension)
|
63
|
-
|
64
|
-
|
65
|
-
@db.lookup_by_extension(extension)
|
66
|
-
@db.lookup_by_extension(extension.downcase)
|
67
|
-
end
|
61
|
+
@db ||= new
|
62
|
+
@db.lookup_by_extension(extension) ||
|
63
|
+
@db.lookup_by_extension(extension.downcase)
|
68
64
|
end
|
69
65
|
|
70
66
|
def self.lookup_by_content_type(content_type)
|
71
|
-
|
72
|
-
|
73
|
-
@db.lookup_by_content_type(content_type)
|
74
|
-
end
|
67
|
+
@db ||= new
|
68
|
+
@db.lookup_by_content_type(content_type)
|
75
69
|
end
|
76
70
|
|
77
71
|
class Cache
|
@@ -91,14 +85,40 @@ module MiniMime
|
|
91
85
|
end
|
92
86
|
end
|
93
87
|
|
88
|
+
if ::File.method_defined?(:pread)
|
89
|
+
PReadFile = ::File
|
90
|
+
else
|
91
|
+
# For Windows support
|
92
|
+
class PReadFile
|
93
|
+
def initialize(filename)
|
94
|
+
@mutex = Mutex.new
|
95
|
+
# We must open the file in binary mode
|
96
|
+
# otherwise Ruby's automatic line terminator
|
97
|
+
# translation will skew the row size
|
98
|
+
@file = ::File.open(filename, 'rb')
|
99
|
+
end
|
100
|
+
|
101
|
+
def readline(*args)
|
102
|
+
@file.readline(*args)
|
103
|
+
end
|
104
|
+
|
105
|
+
def pread(size, offset)
|
106
|
+
@mutex.synchronize do
|
107
|
+
@file.seek(offset, IO::SEEK_SET)
|
108
|
+
@file.read(size)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
94
114
|
class RandomAccessDb
|
95
115
|
MAX_CACHED = 100
|
96
116
|
|
97
117
|
def initialize(path, sort_order)
|
98
118
|
@path = path
|
99
|
-
@file =
|
119
|
+
@file = PReadFile.new(@path)
|
100
120
|
|
101
|
-
@row_length = @file.readline.length
|
121
|
+
@row_length = @file.readline("\n").length
|
102
122
|
@file_length = File.size(@path)
|
103
123
|
@rows = @file_length / @row_length
|
104
124
|
|
@@ -146,8 +166,7 @@ module MiniMime
|
|
146
166
|
end
|
147
167
|
|
148
168
|
def resolve(row)
|
149
|
-
@file.
|
150
|
-
Info.new(@file.readline)
|
169
|
+
Info.new(@file.pread(@row_length, row * @row_length).force_encoding(Encoding::UTF_8))
|
151
170
|
end
|
152
171
|
end
|
153
172
|
|
data/mini_mime.gemspec
CHANGED
@@ -10,8 +10,8 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.authors = ["Sam Saffron"]
|
11
11
|
spec.email = ["sam.saffron@gmail.com"]
|
12
12
|
|
13
|
-
spec.summary = %q{A
|
14
|
-
spec.description = %q{A
|
13
|
+
spec.summary = %q{A minimal mime type library}
|
14
|
+
spec.description = %q{A minimal mime type library}
|
15
15
|
spec.homepage = "https://github.com/discourse/mini_mime"
|
16
16
|
spec.license = "MIT"
|
17
17
|
|
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.bindir = "exe"
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ["lib"]
|
24
|
+
spec.required_ruby_version = ">= 2.6.0"
|
24
25
|
|
25
26
|
spec.add_development_dependency "bundler"
|
26
27
|
spec.add_development_dependency "rake"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mini_mime
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Saffron
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,7 +80,7 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
-
description: A
|
83
|
+
description: A minimal mime type library
|
84
84
|
email:
|
85
85
|
- sam.saffron@gmail.com
|
86
86
|
executables: []
|
@@ -118,15 +118,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
118
118
|
requirements:
|
119
119
|
- - ">="
|
120
120
|
- !ruby/object:Gem::Version
|
121
|
-
version:
|
121
|
+
version: 2.6.0
|
122
122
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
123
|
requirements:
|
124
124
|
- - ">="
|
125
125
|
- !ruby/object:Gem::Version
|
126
126
|
version: '0'
|
127
127
|
requirements: []
|
128
|
-
rubygems_version: 3.
|
128
|
+
rubygems_version: 3.4.6
|
129
129
|
signing_key:
|
130
130
|
specification_version: 4
|
131
|
-
summary: A
|
131
|
+
summary: A minimal mime type library
|
132
132
|
test_files: []
|