mini_mime 1.0.2 → 1.1.2
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 +40 -0
- data/.github/workflows/db.yml +26 -0
- data/.rubocop.yml +5 -0
- data/CHANGELOG +16 -0
- data/Gemfile +1 -0
- data/README.md +3 -0
- data/Rakefile +9 -8
- data/bench/bench.rb +1 -2
- data/bin/console +1 -0
- data/bin/db_pull_request +20 -0
- data/lib/db/content_type_mime.db +27 -2
- data/lib/db/ext_mime.db +29 -3
- data/lib/mini_mime/version.rb +2 -1
- data/lib/mini_mime.rb +5 -4
- data/mini_mime.gemspec +5 -3
- metadata +48 -17
- data/.travis.yml +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69ca27284c4e5ea1ed0cb7168b4f607f9b990f51ab4359e84b2e885e728b076d
|
4
|
+
data.tar.gz: fcea561edc2c9a3be7b6755cdb43b0b3cde7f6c34090f6271daf1760fd8ced2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b65b3456107b00dcb2891f5b86cb4c134a7bdd187043670edbd2f8a7c6c8034b66efd40a5fd2a56711b53bb34249c792d88315d04b59327a775ce5483294769e
|
7
|
+
data.tar.gz: 1d488dc9b02a5a871dc313ab72860813b2e7245f9e889896e8072afaa5e31592850baa21249424765d7047c043431f61836a76078fc7b1ecc195c4f68465f97d
|
@@ -0,0 +1,40 @@
|
|
1
|
+
name: Mini Mime Tests
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
push:
|
6
|
+
branches:
|
7
|
+
- master
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
build:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
name: "Ruby ${{ matrix.ruby }} / Failure allowed: ${{ matrix.experimental }}"
|
13
|
+
continue-on-error: ${{ matrix.experimental }}
|
14
|
+
strategy:
|
15
|
+
fail-fast: false
|
16
|
+
matrix:
|
17
|
+
ruby: ["2.4", "2.5", "2.6", "2.7"]
|
18
|
+
experimental: [false]
|
19
|
+
include:
|
20
|
+
- ruby: "ruby-head"
|
21
|
+
experimental: true
|
22
|
+
- ruby: "truffleruby-head"
|
23
|
+
experimental: true
|
24
|
+
- ruby: "jruby-head"
|
25
|
+
experimental: true
|
26
|
+
- ruby: "jruby-9.1.17.0"
|
27
|
+
experimental: true
|
28
|
+
- ruby: "jruby-9.2.13.0"
|
29
|
+
experimental: true
|
30
|
+
steps:
|
31
|
+
- uses: actions/checkout@v2
|
32
|
+
- uses: ruby/setup-ruby@v1
|
33
|
+
with:
|
34
|
+
ruby-version: ${{ matrix.ruby }}
|
35
|
+
bundler-cache: true
|
36
|
+
- name: Rubocop
|
37
|
+
run: bundle exec rubocop
|
38
|
+
if: "!contains(matrix.ruby, 'jruby')"
|
39
|
+
- name: Tests
|
40
|
+
run: bundle exec rake test
|
@@ -0,0 +1,26 @@
|
|
1
|
+
name: Update MIME type DB
|
2
|
+
|
3
|
+
on:
|
4
|
+
schedule:
|
5
|
+
# 10am on the 1st every month https://crontab.guru/#0_10_1_*_*
|
6
|
+
- cron: "0 10 1 * *"
|
7
|
+
workflow_dispatch:
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
update_db:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
name: "Update MIME type DB"
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v2
|
15
|
+
- uses: ruby/setup-ruby@v1
|
16
|
+
with:
|
17
|
+
ruby-version: "2.7"
|
18
|
+
bundler-cache: true
|
19
|
+
- name: Update mime-types-data
|
20
|
+
run: bundle update mime-types-data
|
21
|
+
- name: Update DB
|
22
|
+
run: bundle exec rake rebuild_db
|
23
|
+
- name: Create PR
|
24
|
+
run: bin/db_pull_request
|
25
|
+
env:
|
26
|
+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
data/.rubocop.yml
ADDED
data/CHANGELOG
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
11-10-2021
|
2
|
+
- Version 1.1.2
|
3
|
+
- update mime types from upstream
|
4
|
+
|
5
|
+
23-08-2021
|
6
|
+
- Version 1.1.1
|
7
|
+
- update mime types from upstream
|
8
|
+
|
9
|
+
05-04-2021
|
10
|
+
- Version 1.1.0
|
11
|
+
- MiniMime.lookup_by_extension is now case insensitive
|
12
|
+
|
13
|
+
26-03-2021
|
14
|
+
- Version 1.0.3
|
15
|
+
- Update mime types from upstream
|
16
|
+
|
1
17
|
08-07-2019
|
2
18
|
- Version 1.0.2
|
3
19
|
- Update mime types from upstream
|
data/Gemfile
CHANGED
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require "bundler/gem_tasks"
|
2
3
|
require "rake/testtask"
|
3
4
|
|
@@ -7,7 +8,7 @@ Rake::TestTask.new(:test) do |t|
|
|
7
8
|
t.test_files = FileList['test/**/*_test.rb']
|
8
9
|
end
|
9
10
|
|
10
|
-
task :
|
11
|
+
task default: :test
|
11
12
|
|
12
13
|
def pad(array)
|
13
14
|
max = []
|
@@ -36,11 +37,11 @@ task :rebuild_db do
|
|
36
37
|
index = {}
|
37
38
|
|
38
39
|
MIME::Types.each do |type|
|
39
|
-
type.extensions.each {|ext| (index[ext.downcase] ||= []) << type}
|
40
|
+
type.extensions.each { |ext| (index[ext.downcase] ||= []) << type }
|
40
41
|
end
|
41
42
|
|
42
|
-
index.each do |k,list|
|
43
|
-
list.sort!{|a,b| a.priority_compare(b)}
|
43
|
+
index.each do |k, list|
|
44
|
+
list.sort! { |a, b| a.priority_compare(b) }
|
44
45
|
end
|
45
46
|
|
46
47
|
buffer = []
|
@@ -54,9 +55,9 @@ task :rebuild_db do
|
|
54
55
|
|
55
56
|
pad(buffer)
|
56
57
|
|
57
|
-
buffer.sort!{|a,b| a[0] <=> b[0]}
|
58
|
+
buffer.sort! { |a, b| a[0] <=> b[0] }
|
58
59
|
|
59
|
-
File.open("lib/db/ext_mime.db", File::CREAT|File::TRUNC|File::RDWR) do |f|
|
60
|
+
File.open("lib/db/ext_mime.db", File::CREAT | File::TRUNC | File::RDWR) do |f|
|
60
61
|
buffer.each do |row|
|
61
62
|
f.write "#{row[0]} #{row[1]} #{row[2]}\n"
|
62
63
|
end
|
@@ -64,7 +65,7 @@ task :rebuild_db do
|
|
64
65
|
|
65
66
|
puts "#{buffer.count} rows written to lib/db/ext_mime.db"
|
66
67
|
|
67
|
-
buffer.sort!{|a,b| [a[1], a[0]] <=> [b[1], b[0]]}
|
68
|
+
buffer.sort! { |a, b| [a[1], a[0]] <=> [b[1], b[0]] }
|
68
69
|
|
69
70
|
# strip cause we are going to re-pad
|
70
71
|
buffer.each do |row|
|
@@ -80,7 +81,7 @@ task :rebuild_db do
|
|
80
81
|
|
81
82
|
pad(buffer)
|
82
83
|
|
83
|
-
File.open("lib/db/content_type_mime.db", File::CREAT|File::TRUNC|File::RDWR) do |f|
|
84
|
+
File.open("lib/db/content_type_mime.db", File::CREAT | File::TRUNC | File::RDWR) do |f|
|
84
85
|
last = nil
|
85
86
|
count = 0
|
86
87
|
buffer.each do |row|
|
data/bench/bench.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'memory_profiler'
|
2
3
|
require 'benchmark/ips'
|
3
4
|
|
4
5
|
$: << File.expand_path('../../lib', __FILE__)
|
5
6
|
|
6
|
-
|
7
7
|
puts
|
8
8
|
puts "Memory stats for requiring mime/types/columnar"
|
9
9
|
result = MemoryProfiler.report do
|
@@ -22,7 +22,6 @@ end
|
|
22
22
|
puts "Total allocated: #{result.total_allocated_memsize} bytes (#{result.total_allocated} objects)"
|
23
23
|
puts "Total retained: #{result.total_retained_memsize} bytes (#{result.total_retained} objects)"
|
24
24
|
|
25
|
-
|
26
25
|
Benchmark.ips do |bm|
|
27
26
|
bm.report 'cached content_type lookup MiniMime' do
|
28
27
|
MiniMime.lookup_by_filename("a.txt").content_type
|
data/bin/console
CHANGED
data/bin/db_pull_request
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "time"
|
5
|
+
|
6
|
+
if `git status --porcelain lib/db`.empty?
|
7
|
+
puts "Skipping, no DB changes to commit..."
|
8
|
+
return
|
9
|
+
end
|
10
|
+
|
11
|
+
moment = Time.now.utc
|
12
|
+
branch_name = "db-updates-#{moment.strftime("%Y%m%d%H%M%S")}"
|
13
|
+
|
14
|
+
system("git", "checkout", "-b", branch_name) || abort("Unable to create branch")
|
15
|
+
system("git", "add", "lib/db")
|
16
|
+
system("git", "config", "--local", "user.email", "actions@github.com")
|
17
|
+
system("git", "config", "--local", "user.name", "github-actions")
|
18
|
+
system("git", "commit", "-m", "DB updates #{moment.iso8601}") || abort("Unable to commit changes")
|
19
|
+
system("git", "push", "-u", "origin", branch_name) || abort("Unable to push branch")
|
20
|
+
system("gh", "pr", "create", "--title", "DB updates #{moment.iso8601}", "--body", "From Github Actions") || abort("Unable to create PR")
|
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
|
@@ -71,7 +72,7 @@ crl application/pkix-crl
|
|
71
72
|
pkipath application/pkix-pkipath base64
|
72
73
|
pki application/pkixcmp base64
|
73
74
|
pls application/pls+xml base64
|
74
|
-
|
75
|
+
eps application/postscript 8bit
|
75
76
|
cw application/prs.cww base64
|
76
77
|
rnd application/prs.nprend base64
|
77
78
|
pskcxml application/pskc+xml base64
|
@@ -561,6 +562,7 @@ cpt application/x-mac-compactpro
|
|
561
562
|
mie application/x-mie base64
|
562
563
|
mobi application/x-mobipocket-ebook base64
|
563
564
|
application application/x-ms-application base64
|
565
|
+
exe application/x-ms-dos-executable base64
|
564
566
|
lnk application/x-ms-shortcut base64
|
565
567
|
wmd application/x-ms-wmd base64
|
566
568
|
wmz application/x-ms-wmz base64
|
@@ -595,6 +597,7 @@ sh application/x-sh
|
|
595
597
|
shar application/x-shar 8bit
|
596
598
|
swf application/x-shockwave-flash base64
|
597
599
|
xap application/x-silverlight-app base64
|
600
|
+
notebook application/x-smarttech-notebook base64
|
598
601
|
sav application/x-spss base64
|
599
602
|
sql application/x-sql base64
|
600
603
|
sit application/x-stuffit base64
|
@@ -664,6 +667,7 @@ ecelp9600 audio/vnd.nuera.ecelp9600
|
|
664
667
|
qcp audio/vnd.qcelp base64
|
665
668
|
rip audio/vnd.rip base64
|
666
669
|
smp3 audio/vnd.sealedmedia.softseal.mpeg base64
|
670
|
+
wav audio/wav base64
|
667
671
|
weba audio/webm base64
|
668
672
|
aac audio/x-aac base64
|
669
673
|
aif audio/x-aiff base64
|
@@ -676,7 +680,6 @@ wma audio/x-ms-wma
|
|
676
680
|
wmv audio/x-ms-wmv base64
|
677
681
|
ra audio/x-pn-realaudio base64
|
678
682
|
rmp audio/x-pn-realaudio-plugin base64
|
679
|
-
wav audio/x-wav base64
|
680
683
|
xm audio/xm base64
|
681
684
|
cdx chemical/x-cdx base64
|
682
685
|
cif chemical/x-cif base64
|
@@ -688,9 +691,14 @@ otf font/otf
|
|
688
691
|
ttf font/ttf base64
|
689
692
|
woff font/woff base64
|
690
693
|
woff2 font/woff2 base64
|
694
|
+
avif image/avif base64
|
691
695
|
cgm image/cgm base64
|
692
696
|
g3 image/g3fax base64
|
693
697
|
gif image/gif base64
|
698
|
+
heic image/heic base64
|
699
|
+
heics image/heic-sequence base64
|
700
|
+
heif image/heif base64
|
701
|
+
heifs image/heif-sequence base64
|
694
702
|
ief image/ief base64
|
695
703
|
jp2 image/jp2 base64
|
696
704
|
jpeg image/jpeg base64
|
@@ -722,21 +730,37 @@ wbmp image/vnd.wap.wbmp
|
|
722
730
|
xif image/vnd.xiff base64
|
723
731
|
webp image/webp base64
|
724
732
|
3ds image/x-3ds base64
|
733
|
+
dng image/x-adobe-dng base64
|
725
734
|
bmp image/x-bmp base64
|
735
|
+
cr2 image/x-canon-cr2 base64
|
736
|
+
crw image/x-canon-crw base64
|
726
737
|
ras image/x-cmu-raster base64
|
727
738
|
cmx image/x-cmx base64
|
728
739
|
xcfbz2 image/x-compressed-xcf base64
|
740
|
+
erf image/x-epson-erf base64
|
729
741
|
fh image/x-freehand base64
|
742
|
+
raf image/x-fuji-raf base64
|
730
743
|
3fr image/x-hasselblad-3fr base64
|
744
|
+
k25 image/x-kodak-k25 base64
|
745
|
+
kdc image/x-kodak-kdc base64
|
746
|
+
mrw image/x-minolta-mrw base64
|
731
747
|
sid image/x-mrsid-image base64
|
748
|
+
nef image/x-nikon-nef base64
|
749
|
+
orf image/x-olympus-orf base64
|
732
750
|
psp image/x-paintshoppro base64
|
751
|
+
raw image/x-panasonic-raw base64
|
733
752
|
pcx image/x-pcx base64
|
753
|
+
pef image/x-pentax-pef base64
|
734
754
|
pct image/x-pict base64
|
735
755
|
pnm image/x-portable-anymap base64
|
736
756
|
pbm image/x-portable-bitmap base64
|
737
757
|
pgm image/x-portable-graymap base64
|
738
758
|
ppm image/x-portable-pixmap base64
|
739
759
|
rgb image/x-rgb base64
|
760
|
+
x3f image/x-sigma-x3f base64
|
761
|
+
arw image/x-sony-arw base64
|
762
|
+
sr2 image/x-sony-sr2 base64
|
763
|
+
srf image/x-sony-srf base64
|
740
764
|
tga image/x-targa base64
|
741
765
|
dgn image/x-vnd.dgn base64
|
742
766
|
xbm image/x-xbitmap 7bit
|
@@ -788,6 +812,7 @@ si text/vnd.wap.si
|
|
788
812
|
sl text/vnd.wap.sl quoted-printable
|
789
813
|
wml text/vnd.wap.wml quoted-printable
|
790
814
|
wmls text/vnd.wap.wmlscript quoted-printable
|
815
|
+
vtt text/vtt quoted-printable
|
791
816
|
asm text/x-asm quoted-printable
|
792
817
|
c text/x-c quoted-printable
|
793
818
|
coffee text/x-coffescript 8bit
|
data/lib/db/ext_mime.db
CHANGED
@@ -24,7 +24,7 @@ aep application/vnd.audiograph
|
|
24
24
|
afm application/x-font-type1 base64
|
25
25
|
afp application/vnd.ibm.modcap base64
|
26
26
|
ahead application/vnd.ahead.space base64
|
27
|
-
ai application/
|
27
|
+
ai application/pdf base64
|
28
28
|
aif audio/x-aiff base64
|
29
29
|
aifc audio/x-aiff base64
|
30
30
|
aiff audio/x-aiff base64
|
@@ -38,6 +38,7 @@ appcache text/cache-manifest
|
|
38
38
|
application application/x-ms-application base64
|
39
39
|
apr application/vnd.lotus-approach base64
|
40
40
|
arc application/x-freearc base64
|
41
|
+
arw image/x-sony-arw base64
|
41
42
|
asc application/pgp-signature base64
|
42
43
|
asf application/vnd.ms-asf base64
|
43
44
|
asm text/x-asm quoted-printable
|
@@ -50,6 +51,7 @@ atomsvc application/atomsvc+xml
|
|
50
51
|
atx application/vnd.antix.game-component base64
|
51
52
|
au audio/basic base64
|
52
53
|
avi video/x-msvideo base64
|
54
|
+
avif image/avif base64
|
53
55
|
aw application/applixware base64
|
54
56
|
awb audio/AMR-WB base64
|
55
57
|
azf application/vnd.airzip.filesecure.azf base64
|
@@ -142,9 +144,11 @@ cpi video/MP2T
|
|
142
144
|
cpio application/x-cpio base64
|
143
145
|
cpp text/plain quoted-printable
|
144
146
|
cpt application/x-mac-compactpro base64
|
147
|
+
cr2 image/x-canon-cr2 base64
|
145
148
|
crd application/x-mscardfile base64
|
146
149
|
crl application/pkix-crl base64
|
147
150
|
crt application/x-x509-ca-cert base64
|
151
|
+
crw image/x-canon-crw base64
|
148
152
|
crx application/x-chrome-extension base64
|
149
153
|
cryptonote application/vnd.rig.cryptonote base64
|
150
154
|
csh application/x-csh 8bit
|
@@ -192,6 +196,7 @@ dmg application/x-apple-diskimage
|
|
192
196
|
dmp application/vnd.tcpdump.pcap base64
|
193
197
|
dms application/octet-stream base64
|
194
198
|
dna application/vnd.dna base64
|
199
|
+
dng image/x-adobe-dng base64
|
195
200
|
doc application/msword base64
|
196
201
|
docm application/vnd.ms-word.document.macroEnabled.12 base64
|
197
202
|
docx application/vnd.openxmlformats-officedocument.wordprocessingml.document base64
|
@@ -237,6 +242,7 @@ eol audio/vnd.digital-winds
|
|
237
242
|
eot application/vnd.ms-fontobject base64
|
238
243
|
eps application/postscript 8bit
|
239
244
|
epub application/epub+zip base64
|
245
|
+
erf image/x-epson-erf base64
|
240
246
|
es application/ecmascript base64
|
241
247
|
es3 application/vnd.eszigno3+xml base64
|
242
248
|
esa application/vnd.osgi.subsystem base64
|
@@ -246,7 +252,7 @@ etx text/x-setext
|
|
246
252
|
eva application/x-eva base64
|
247
253
|
evc audio/EVRC base64
|
248
254
|
evy application/x-envoy base64
|
249
|
-
exe application/
|
255
|
+
exe application/x-ms-dos-executable base64
|
250
256
|
exi application/exi base64
|
251
257
|
ext application/vnd.novadigm.EXT base64
|
252
258
|
ez application/andrew-inset base64
|
@@ -340,8 +346,13 @@ hal application/vnd.hal+xml
|
|
340
346
|
hbc application/vnd.hbci base64
|
341
347
|
hbci application/vnd.hbci base64
|
342
348
|
hdf application/x-hdf base64
|
349
|
+
heic image/heic base64
|
350
|
+
heics image/heic-sequence base64
|
351
|
+
heif image/heif base64
|
352
|
+
heifs image/heif-sequence base64
|
343
353
|
hep application/x-hep base64
|
344
354
|
hh text/plain quoted-printable
|
355
|
+
hif image/heic base64
|
345
356
|
hlp text/plain quoted-printable
|
346
357
|
hpgl application/vnd.hp-HPGL base64
|
347
358
|
hpid application/vnd.hp-hpid base64
|
@@ -414,9 +425,11 @@ jpx image/jpx
|
|
414
425
|
js application/javascript 8bit
|
415
426
|
json application/json 8bit
|
416
427
|
jsonml application/jsonml+json base64
|
428
|
+
k25 image/x-kodak-k25 base64
|
417
429
|
kar audio/midi base64
|
418
430
|
karbon application/vnd.kde.karbon base64
|
419
431
|
kcm application/vnd.nervana base64
|
432
|
+
kdc image/x-kodak-kdc base64
|
420
433
|
key application/x-iwork-keynote-sffkey base64
|
421
434
|
kfo application/vnd.kde.kformula base64
|
422
435
|
kia application/vnd.kidspiration base64
|
@@ -550,6 +563,7 @@ mpy application/vnd.ibm.MiniPay
|
|
550
563
|
mqy application/vnd.Mobius.MQY base64
|
551
564
|
mrc application/marc base64
|
552
565
|
mrcx application/marcxml+xml base64
|
566
|
+
mrw image/x-minolta-mrw base64
|
553
567
|
ms text/troff 8bit
|
554
568
|
mscml application/mediaservercontrol+xml base64
|
555
569
|
mseed application/vnd.fdsn.mseed base64
|
@@ -577,6 +591,7 @@ nb application/mathematica
|
|
577
591
|
nbp application/vnd.wolfram.player base64
|
578
592
|
nc application/netcdf base64
|
579
593
|
ncx application/x-dtbncx+xml base64
|
594
|
+
nef image/x-nikon-nef base64
|
580
595
|
nfo text/x-nfo quoted-printable
|
581
596
|
ngdat application/vnd.nokia.n-gage.data base64
|
582
597
|
nim video/vnd.nokia.interleaved-multimedia base64
|
@@ -586,6 +601,7 @@ nml application/vnd.enliven
|
|
586
601
|
nnd application/vnd.noblenet-directory base64
|
587
602
|
nns application/vnd.noblenet-sealer base64
|
588
603
|
nnw application/vnd.noblenet-web base64
|
604
|
+
notebook application/x-smarttech-notebook base64
|
589
605
|
npx image/vnd.net-fpx base64
|
590
606
|
nsc application/x-conference base64
|
591
607
|
nsf application/vnd.lotus-notes base64
|
@@ -621,6 +637,8 @@ onetoc2 application/onenote
|
|
621
637
|
opf application/oebps-package+xml base64
|
622
638
|
opml text/x-opml quoted-printable
|
623
639
|
oprc application/vnd.palm base64
|
640
|
+
opus audio/ogg base64
|
641
|
+
orf image/x-olympus-orf base64
|
624
642
|
org application/vnd.lotus-organizer base64
|
625
643
|
osf application/vnd.yamaha.openscoreformat base64
|
626
644
|
osfpvg application/vnd.yamaha.openscoreformat.osfpvg+xml base64
|
@@ -658,6 +676,7 @@ pcurl application/vnd.curl.pcurl
|
|
658
676
|
pcx image/x-pcx base64
|
659
677
|
pdb application/vnd.palm base64
|
660
678
|
pdf application/pdf base64
|
679
|
+
pef image/x-pentax-pef base64
|
661
680
|
pfa application/x-font-type1 base64
|
662
681
|
pfb application/x-font-type1 base64
|
663
682
|
pfm application/x-font-type1 base64
|
@@ -736,9 +755,11 @@ qxd application/vnd.Quark.QuarkXPress
|
|
736
755
|
qxl application/vnd.Quark.QuarkXPress 8bit
|
737
756
|
qxt application/vnd.Quark.QuarkXPress 8bit
|
738
757
|
ra audio/x-pn-realaudio base64
|
758
|
+
raf image/x-fuji-raf base64
|
739
759
|
ram audio/x-pn-realaudio base64
|
740
760
|
rar application/x-rar-compressed base64
|
741
761
|
ras image/x-cmu-raster base64
|
762
|
+
raw image/x-panasonic-raw base64
|
742
763
|
rb application/x-ruby 8bit
|
743
764
|
rbw application/x-ruby 8bit
|
744
765
|
rcprofile application/vnd.ipunplugged.rcprofile base64
|
@@ -883,7 +904,9 @@ spq application/scvp-vp-request
|
|
883
904
|
sps application/x-spss base64
|
884
905
|
spx audio/ogg base64
|
885
906
|
sql application/x-sql base64
|
907
|
+
sr2 image/x-sony-sr2 base64
|
886
908
|
src application/x-wais-source base64
|
909
|
+
srf image/x-sony-srf base64
|
887
910
|
srt application/x-subrip base64
|
888
911
|
sru application/sru+xml base64
|
889
912
|
srx application/sparql-results+xml base64
|
@@ -1032,12 +1055,13 @@ vsf application/vnd.vsf
|
|
1032
1055
|
vss application/vnd.visio base64
|
1033
1056
|
vst application/vnd.visio base64
|
1034
1057
|
vsw application/vnd.visio base64
|
1058
|
+
vtt text/vtt quoted-printable
|
1035
1059
|
vtu model/vnd.vtu base64
|
1036
1060
|
vxml application/voicexml+xml base64
|
1037
1061
|
w3d application/x-director base64
|
1038
1062
|
wad application/x-doom base64
|
1039
1063
|
wasm application/wasm 8bit
|
1040
|
-
wav audio/
|
1064
|
+
wav audio/wav base64
|
1041
1065
|
wax audio/x-ms-wax base64
|
1042
1066
|
wbmp image/vnd.wap.wbmp base64
|
1043
1067
|
wbs application/vnd.criticaltools.wbs+xml base64
|
@@ -1048,6 +1072,7 @@ wdp image/vnd.ms-photo
|
|
1048
1072
|
weba audio/webm base64
|
1049
1073
|
webapp application/x-web-app-manifest+json base64
|
1050
1074
|
webm audio/webm base64
|
1075
|
+
webmanifest application/manifest+json base64
|
1051
1076
|
webp image/webp base64
|
1052
1077
|
wg application/vnd.pmi.widget base64
|
1053
1078
|
wgt application/widget base64
|
@@ -1091,6 +1116,7 @@ x3dbz model/x3d+binary
|
|
1091
1116
|
x3dv model/x3d+vrml base64
|
1092
1117
|
x3dvz model/x3d+vrml base64
|
1093
1118
|
x3dz model/x3d+xml base64
|
1119
|
+
x3f image/x-sigma-x3f base64
|
1094
1120
|
x_b model/vnd.parasolid.transmit.binary base64
|
1095
1121
|
x_t model/vnd.parasolid.transmit.text quoted-printable
|
1096
1122
|
xaml application/xaml+xml base64
|
data/lib/mini_mime/version.rb
CHANGED
data/lib/mini_mime.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require "mini_mime/version"
|
2
3
|
require "thread"
|
3
4
|
|
@@ -55,14 +56,14 @@ module MiniMime
|
|
55
56
|
extension = File.extname(filename)
|
56
57
|
return if extension.empty?
|
57
58
|
extension = extension[1..-1]
|
58
|
-
extension.downcase!
|
59
59
|
lookup_by_extension(extension)
|
60
60
|
end
|
61
61
|
|
62
62
|
def self.lookup_by_extension(extension)
|
63
63
|
LOCK.synchronize do
|
64
64
|
@db ||= new
|
65
|
-
@db.lookup_by_extension(extension)
|
65
|
+
@db.lookup_by_extension(extension) ||
|
66
|
+
@db.lookup_by_extension(extension.downcase)
|
66
67
|
end
|
67
68
|
end
|
68
69
|
|
@@ -129,7 +130,7 @@ module MiniMime
|
|
129
130
|
result = nil
|
130
131
|
|
131
132
|
while from <= to do
|
132
|
-
midpoint = from + (to-from).div(2)
|
133
|
+
midpoint = from + (to - from).div(2)
|
133
134
|
current = resolve(midpoint)
|
134
135
|
data = current[@sort_order]
|
135
136
|
if data > val
|
@@ -145,7 +146,7 @@ module MiniMime
|
|
145
146
|
end
|
146
147
|
|
147
148
|
def resolve(row)
|
148
|
-
@file.seek(row
|
149
|
+
@file.seek(row * @row_length)
|
149
150
|
Info.new(@file.readline)
|
150
151
|
end
|
151
152
|
end
|
data/mini_mime.gemspec
CHANGED
@@ -22,7 +22,9 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ["lib"]
|
24
24
|
|
25
|
-
spec.add_development_dependency "bundler"
|
26
|
-
spec.add_development_dependency "rake"
|
27
|
-
spec.add_development_dependency "minitest"
|
25
|
+
spec.add_development_dependency "bundler"
|
26
|
+
spec.add_development_dependency "rake"
|
27
|
+
spec.add_development_dependency "minitest"
|
28
|
+
spec.add_development_dependency "rubocop"
|
29
|
+
spec.add_development_dependency "rubocop-discourse"
|
28
30
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Saffron
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,42 +16,70 @@ 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
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
61
|
+
version: '0'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- - "
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop-discourse
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
53
81
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
82
|
+
version: '0'
|
55
83
|
description: A lightweight mime type lookup toy
|
56
84
|
email:
|
57
85
|
- sam.saffron@gmail.com
|
@@ -59,8 +87,10 @@ executables: []
|
|
59
87
|
extensions: []
|
60
88
|
extra_rdoc_files: []
|
61
89
|
files:
|
90
|
+
- ".github/workflows/ci.yml"
|
91
|
+
- ".github/workflows/db.yml"
|
62
92
|
- ".gitignore"
|
63
|
-
- ".
|
93
|
+
- ".rubocop.yml"
|
64
94
|
- CHANGELOG
|
65
95
|
- CODE_OF_CONDUCT.md
|
66
96
|
- Gemfile
|
@@ -69,6 +99,7 @@ files:
|
|
69
99
|
- Rakefile
|
70
100
|
- bench/bench.rb
|
71
101
|
- bin/console
|
102
|
+
- bin/db_pull_request
|
72
103
|
- bin/setup
|
73
104
|
- lib/db/content_type_mime.db
|
74
105
|
- lib/db/ext_mime.db
|
@@ -79,7 +110,7 @@ homepage: https://github.com/discourse/mini_mime
|
|
79
110
|
licenses:
|
80
111
|
- MIT
|
81
112
|
metadata: {}
|
82
|
-
post_install_message:
|
113
|
+
post_install_message:
|
83
114
|
rdoc_options: []
|
84
115
|
require_paths:
|
85
116
|
- lib
|
@@ -94,8 +125,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
125
|
- !ruby/object:Gem::Version
|
95
126
|
version: '0'
|
96
127
|
requirements: []
|
97
|
-
rubygems_version: 3.
|
98
|
-
signing_key:
|
128
|
+
rubygems_version: 3.1.6
|
129
|
+
signing_key:
|
99
130
|
specification_version: 4
|
100
131
|
summary: A lightweight mime type lookup toy
|
101
132
|
test_files: []
|
data/.travis.yml
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
|
3
|
-
rvm:
|
4
|
-
- 2.3
|
5
|
-
- 2.4
|
6
|
-
- 2.5
|
7
|
-
- 2.6
|
8
|
-
- ruby-head
|
9
|
-
- jruby
|
10
|
-
- jruby-9.0.5.0
|
11
|
-
- jruby-9.1.6.0
|
12
|
-
- jruby-head
|
13
|
-
|
14
|
-
matrix:
|
15
|
-
allow_failures:
|
16
|
-
- rvm: ruby-head
|
17
|
-
- rvm: jruby-9.0.5.0
|
18
|
-
- rvm: jruby-9.1.6.0
|
19
|
-
- rvm: jruby-head
|
20
|
-
fast_finish: true
|