mini_mime 1.0.3 → 1.1.5
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 +20 -7
- data/.github/workflows/db.yml +1 -1
- data/CHANGELOG +24 -0
- data/lib/db/content_type_mime.db +5 -1
- data/lib/db/ext_mime.db +8 -3
- data/lib/mini_mime/version.rb +1 -1
- data/lib/mini_mime.rb +34 -15
- data/mini_mime.gemspec +6 -5
- metadata +16 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ba74b6b26e15d4b3c4415cd261469a5ef423a56a12e836b94b92a488ea275ef
|
4
|
+
data.tar.gz: 8a85a122d5e0d8e43513eef375b899a2501c51988acca191a2f299aeef7b2065
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d591fdc7a13ef2e1d8b05195b73dab9352263cad29fe60487c7d418e8fe135b021ebee2b485f79b031eb53df92b2dda97bc0db208b57363a430089323c5cd61f
|
7
|
+
data.tar.gz: 1d9971f665cfdf6cfc73d80183ee7ccfdbb27261177de17b70ad839203b6f898d8ff322159e3c36525c6d1ebef2d24500aced4f42f75ebbd3e7f955e7fcb853a
|
data/.github/workflows/ci.yml
CHANGED
@@ -4,29 +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"
|
28
|
+
experimental: true
|
29
|
+
- ruby: "truffleruby-head"
|
30
|
+
os: "ubuntu"
|
21
31
|
experimental: true
|
22
32
|
- ruby: "jruby-head"
|
33
|
+
os: "ubuntu"
|
23
34
|
experimental: true
|
24
|
-
- ruby: "jruby-9.
|
35
|
+
- ruby: "jruby-9.3.9.0"
|
36
|
+
os: "ubuntu"
|
25
37
|
experimental: true
|
26
|
-
- ruby: "jruby-9.
|
38
|
+
- ruby: "jruby-9.4.0.0"
|
39
|
+
os: "ubuntu"
|
27
40
|
experimental: true
|
28
41
|
steps:
|
29
|
-
- uses: actions/checkout@
|
42
|
+
- uses: actions/checkout@v3
|
30
43
|
- uses: ruby/setup-ruby@v1
|
31
44
|
with:
|
32
45
|
ruby-version: ${{ matrix.ruby }}
|
data/.github/workflows/db.yml
CHANGED
data/CHANGELOG
CHANGED
@@ -1,3 +1,27 @@
|
|
1
|
+
08-08-2023
|
2
|
+
- Version 1.1.5
|
3
|
+
- Update mime types from upstream
|
4
|
+
|
5
|
+
08-08-2023
|
6
|
+
- Version 1.1.4
|
7
|
+
- Version 1.1.3 had issues on Windows which does not support pread, added a polyfill
|
8
|
+
|
9
|
+
04-08-2023
|
10
|
+
- Version 1.1.3
|
11
|
+
- Added fork safety by migrating from seek+read to pread
|
12
|
+
|
13
|
+
11-10-2021
|
14
|
+
- Version 1.1.2
|
15
|
+
- update mime types from upstream
|
16
|
+
|
17
|
+
23-08-2021
|
18
|
+
- Version 1.1.1
|
19
|
+
- update mime types from upstream
|
20
|
+
|
21
|
+
05-04-2021
|
22
|
+
- Version 1.1.0
|
23
|
+
- MiniMime.lookup_by_extension is now case insensitive
|
24
|
+
|
1
25
|
26-03-2021
|
2
26
|
- Version 1.0.3
|
3
27
|
- Update mime types from upstream
|
data/lib/db/content_type_mime.db
CHANGED
@@ -35,6 +35,7 @@ jsonml application/jsonml+json
|
|
35
35
|
lostxml application/lost+xml base64
|
36
36
|
hqx application/mac-binhex40 8bit
|
37
37
|
mads application/mads+xml base64
|
38
|
+
webmanifest application/manifest+json base64
|
38
39
|
mrc application/marc base64
|
39
40
|
mrcx application/marcxml+xml base64
|
40
41
|
ma application/mathematica base64
|
@@ -223,6 +224,7 @@ xbd application/vnd.fujixerox.docuworks.binder
|
|
223
224
|
fzs application/vnd.fuzzysheet base64
|
224
225
|
txd application/vnd.genomatix.tuxedo base64
|
225
226
|
ggb application/vnd.geogebra.file base64
|
227
|
+
ggs application/vnd.geogebra.slides base64
|
226
228
|
ggt application/vnd.geogebra.tool base64
|
227
229
|
gex application/vnd.geometry-explorer base64
|
228
230
|
gxt application/vnd.geonext base64
|
@@ -691,6 +693,7 @@ ttf font/ttf
|
|
691
693
|
woff font/woff base64
|
692
694
|
woff2 font/woff2 base64
|
693
695
|
avif image/avif base64
|
696
|
+
bmp image/bmp base64
|
694
697
|
cgm image/cgm base64
|
695
698
|
g3 image/g3fax base64
|
696
699
|
gif image/gif base64
|
@@ -730,7 +733,6 @@ xif image/vnd.xiff
|
|
730
733
|
webp image/webp base64
|
731
734
|
3ds image/x-3ds base64
|
732
735
|
dng image/x-adobe-dng base64
|
733
|
-
bmp image/x-bmp base64
|
734
736
|
cr2 image/x-canon-cr2 base64
|
735
737
|
crw image/x-canon-crw base64
|
736
738
|
ras image/x-cmu-raster base64
|
@@ -786,6 +788,7 @@ ics text/calendar
|
|
786
788
|
css text/css 8bit
|
787
789
|
csv text/csv 8bit
|
788
790
|
html text/html 8bit
|
791
|
+
js text/javascript quoted-printable
|
789
792
|
markdown text/markdown quoted-printable
|
790
793
|
n3 text/n3 quoted-printable
|
791
794
|
txt text/plain quoted-printable
|
@@ -811,6 +814,7 @@ si text/vnd.wap.si
|
|
811
814
|
sl text/vnd.wap.sl quoted-printable
|
812
815
|
wml text/vnd.wap.wml quoted-printable
|
813
816
|
wmls text/vnd.wap.wmlscript quoted-printable
|
817
|
+
vtt text/vtt quoted-printable
|
814
818
|
asm text/x-asm quoted-printable
|
815
819
|
c text/x-c quoted-printable
|
816
820
|
coffee text/x-coffescript 8bit
|
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
|
@@ -121,6 +121,7 @@ chrt application/vnd.kde.kchart
|
|
121
121
|
cif chemical/x-cif base64
|
122
122
|
cii application/vnd.anser-web-certificate-issue-initiation base64
|
123
123
|
cil application/vnd.ms-artgalry base64
|
124
|
+
cjs text/javascript quoted-printable
|
124
125
|
cla application/vnd.claymore base64
|
125
126
|
class application/octet-stream base64
|
126
127
|
clkk application/vnd.crick.clicker.keyboard base64
|
@@ -312,6 +313,7 @@ gdl model/vnd.gdl
|
|
312
313
|
geo application/vnd.dynageo base64
|
313
314
|
gex application/vnd.geometry-explorer base64
|
314
315
|
ggb application/vnd.geogebra.file base64
|
316
|
+
ggs application/vnd.geogebra.slides base64
|
315
317
|
ggt application/vnd.geogebra.tool base64
|
316
318
|
ghf application/vnd.groove-help base64
|
317
319
|
gif image/gif base64
|
@@ -408,6 +410,7 @@ jad text/vnd.sun.j2me.app-descriptor
|
|
408
410
|
jam application/vnd.jam base64
|
409
411
|
jar application/java-archive base64
|
410
412
|
java text/x-java-source quoted-printable
|
413
|
+
jfif image/jpeg base64
|
411
414
|
jisp application/vnd.jisp base64
|
412
415
|
jlt application/vnd.hp-jlyt base64
|
413
416
|
jnlp application/x-java-jnlp-file base64
|
@@ -422,7 +425,7 @@ jpgm image/jpm
|
|
422
425
|
jpgv video/JPEG base64
|
423
426
|
jpm image/jpm base64
|
424
427
|
jpx image/jpx base64
|
425
|
-
js
|
428
|
+
js text/javascript quoted-printable
|
426
429
|
json application/json 8bit
|
427
430
|
jsonml application/jsonml+json base64
|
428
431
|
k25 image/x-kodak-k25 base64
|
@@ -521,7 +524,7 @@ mj2 video/MJ2
|
|
521
524
|
mjp2 video/MJ2 base64
|
522
525
|
mjpeg video/x-motion-jpeg base64
|
523
526
|
mjpg video/x-motion-jpeg base64
|
524
|
-
mjs
|
527
|
+
mjs text/javascript quoted-printable
|
525
528
|
mk3d video/x-matroska base64
|
526
529
|
mka audio/x-matroska base64
|
527
530
|
mkd text/markdown quoted-printable
|
@@ -1055,6 +1058,7 @@ vsf application/vnd.vsf
|
|
1055
1058
|
vss application/vnd.visio base64
|
1056
1059
|
vst application/vnd.visio base64
|
1057
1060
|
vsw application/vnd.visio base64
|
1061
|
+
vtt text/vtt quoted-printable
|
1058
1062
|
vtu model/vnd.vtu base64
|
1059
1063
|
vxml application/voicexml+xml base64
|
1060
1064
|
w3d application/x-director base64
|
@@ -1071,6 +1075,7 @@ wdp image/vnd.ms-photo
|
|
1071
1075
|
weba audio/webm base64
|
1072
1076
|
webapp application/x-web-app-manifest+json base64
|
1073
1077
|
webm audio/webm base64
|
1078
|
+
webmanifest application/manifest+json base64
|
1074
1079
|
webp image/webp base64
|
1075
1080
|
wg application/vnd.pmi.widget base64
|
1076
1081
|
wgt application/widget base64
|
data/lib/mini_mime/version.rb
CHANGED
data/lib/mini_mime.rb
CHANGED
@@ -50,28 +50,22 @@ 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?
|
58
56
|
extension = extension[1..-1]
|
59
|
-
extension.downcase!
|
60
57
|
lookup_by_extension(extension)
|
61
58
|
end
|
62
59
|
|
63
60
|
def self.lookup_by_extension(extension)
|
64
|
-
|
65
|
-
|
66
|
-
@db.lookup_by_extension(extension)
|
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,10 +21,11 @@ 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
|
-
spec.add_development_dependency "bundler"
|
26
|
-
spec.add_development_dependency "rake"
|
27
|
-
spec.add_development_dependency "minitest"
|
26
|
+
spec.add_development_dependency "bundler"
|
27
|
+
spec.add_development_dependency "rake"
|
28
|
+
spec.add_development_dependency "minitest"
|
28
29
|
spec.add_development_dependency "rubocop"
|
29
30
|
spec.add_development_dependency "rubocop-discourse"
|
30
31
|
end
|
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.
|
4
|
+
version: 1.1.5
|
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
|
@@ -16,42 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rubocop
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -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: []
|