Skip to content

Commit 22e7d57

Browse files
authored
fix!: eliminate the x- prefix in mime-types (#1927)
1 parent 202751b commit 22e7d57

File tree

10 files changed

+29
-31
lines changed

10 files changed

+29
-31
lines changed

CODE_OF_CONDUCT.MD renamed to CODE_OF_CONDUCT.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Contributor Covenant Code of Conduct
1+
# Code of Conduct
22

33
## Goal
44

@@ -21,7 +21,7 @@ Our standards are as follows:
2121
Examples of unacceptable behavior include:
2222

2323
- Trolling, insulting or derogatory comments, and personal attacks
24-
- Harasing or bullying another person
24+
- Harassing or bullying another person
2525
- Publishing others' private information without their explicit permission
2626
- Posting things unrelated to the topic being discussed
2727
- Other conduct that could reasonably be considered inappropriate in a professional setting

yazi-config/preset/theme.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,13 @@ rules = [
191191

192192
# Archives
193193
{ mime = "application/{,g}zip", fg = "red" },
194-
{ mime = "application/x-{tar,bzip*,7z-compressed,xz,rar}", fg = "red" },
194+
{ mime = "application/{tar,bzip*,7z-compressed,xz,rar}", fg = "red" },
195195

196196
# Documents
197197
{ mime = "application/{pdf,doc,rtf,vnd.*}", fg = "cyan" },
198198

199199
# Empty files
200-
# { mime = "inode/x-empty", fg = "red" },
200+
# { mime = "inode/empty", fg = "red" },
201201

202202
# Special files
203203
{ name = "*", is = "orphan", bg = "red" },

yazi-config/preset/yazi.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ rules = [
6868
{ mime = "{audio,video}/*", use = [ "play", "reveal" ] },
6969
# Archive
7070
{ mime = "application/{,g}zip", use = [ "extract", "reveal" ] },
71-
{ mime = "application/x-{tar,bzip*,7z-compressed,xz,rar}", use = [ "extract", "reveal" ] },
71+
{ mime = "application/{tar,bzip*,7z-compressed,xz,rar}", use = [ "extract", "reveal" ] },
7272
# JSON
73-
{ mime = "application/{json,x-ndjson}", use = [ "edit", "reveal" ] },
73+
{ mime = "application/{json,ndjson}", use = [ "edit", "reveal" ] },
7474
{ mime = "*/javascript", use = [ "edit", "reveal" ] },
7575
# Empty file
76-
{ mime = "inode/x-empty", use = [ "edit", "reveal" ] },
76+
{ mime = "inode/empty", use = [ "edit", "reveal" ] },
7777
# Fallback
7878
{ name = "*", use = [ "open", "reveal" ] },
7979
]
@@ -96,7 +96,7 @@ spotters = [
9696
{ name = "*/", run = "folder" },
9797
# Code
9898
{ mime = "text/*", run = "code" },
99-
{ mime = "*/{xml,javascript,x-wine-extension-ini}", run = "code" },
99+
{ mime = "*/{xml,javascript,wine-extension-ini}", run = "code" },
100100
# Image
101101
{ mime = "image/{avif,hei?,jxl,svg+xml}", run = "magick" },
102102
{ mime = "image/*", run = "image" },
@@ -121,9 +121,9 @@ previewers = [
121121
{ name = "*/", run = "folder", sync = true },
122122
# Code
123123
{ mime = "text/*", run = "code" },
124-
{ mime = "*/{xml,javascript,x-wine-extension-ini}", run = "code" },
124+
{ mime = "*/{xml,javascript,wine-extension-ini}", run = "code" },
125125
# JSON
126-
{ mime = "application/{json,x-ndjson}", run = "json" },
126+
{ mime = "application/{json,ndjson}", run = "json" },
127127
# Image
128128
{ mime = "image/{avif,hei?,jxl,svg+xml}", run = "magick" },
129129
{ mime = "image/*", run = "image" },
@@ -133,12 +133,12 @@ previewers = [
133133
{ mime = "application/pdf", run = "pdf" },
134134
# Archive
135135
{ mime = "application/{,g}zip", run = "archive" },
136-
{ mime = "application/x-{tar,bzip*,7z-compressed,xz,rar,iso9660-image}", run = "archive" },
136+
{ mime = "application/{tar,bzip*,7z-compressed,xz,rar,iso9660-image}", run = "archive" },
137137
# Font
138138
{ mime = "font/*", run = "font" },
139139
{ mime = "application/vnd.ms-opentype", run = "font" },
140140
# Empty file
141-
{ mime = "inode/x-empty", run = "empty" },
141+
{ mime = "inode/empty", run = "empty" },
142142
# Fallback
143143
{ name = "*", run = "file" },
144144
]

yazi-plugin/preset/plugins/code.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ function M:seek(units)
2626
})
2727
end
2828

29-
function M:spot(args) require("file"):spot(args) end
29+
function M:spot(job) require("file"):spot(job) end
3030

3131
return M

yazi-plugin/preset/plugins/file.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ local hovered_mime = ya.sync(function()
2828
end
2929
end)
3030

31-
function M:spot(args)
31+
function M:spot(job)
3232
local mime = hovered_mime()
3333
if not mime then
3434
return
3535
end
3636

37-
local file = args.file
37+
local file = job.file
3838
local spotter = PLUGIN.spotter(file.url, mime)
3939
local previewer = PLUGIN.previewer(file.url, mime)
4040
local fetchers = PLUGIN.fetchers(file.url, mime)
@@ -64,7 +64,7 @@ function M:spot(args)
6464
row(" Preloaders:", #preloaders ~= 0 and preloaders or "-")
6565

6666
ya.spot_table(
67-
args,
67+
job,
6868
ui.Table(rows)
6969
:area(ui.Pos { "center", w = 60, h = 20 })
7070
:row(1)

yazi-plugin/preset/plugins/folder.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ function M:seek(units)
4040
end
4141
end
4242

43-
function M:spot(args) require("file"):spot(args) end
43+
function M:spot(job) require("file"):spot(job) end
4444

4545
return M

yazi-plugin/preset/plugins/image.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ function M:preload()
2222
return ya.image_precache(self.file.url, cache) and 1 or 2
2323
end
2424

25-
function M:spot(args)
26-
local info = ya.image_info(args.file.url)
25+
function M:spot(job)
26+
local info = ya.image_info(job.file.url)
2727

2828
local rows = {}
2929
local row = function(key, value)
@@ -37,10 +37,10 @@ function M:spot(args)
3737
row("Color:", tostring(info.color))
3838

3939
ya.spot_table(
40-
args,
40+
job,
4141
ui.Table(rows)
4242
:area(ui.Pos { "center", w = 60, h = 20 })
43-
:row(args.skip)
43+
:row(job.skip)
4444
:col(1)
4545
:col_style(ui.Style():fg("blue"))
4646
:cell_style(ui.Style():fg("yellow"):reverse())

yazi-plugin/preset/plugins/magick.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,6 @@ function M:preload()
4141
return status and status.success and 1 or 2
4242
end
4343

44-
function M:spot(args) require("file"):spot(args) end
44+
function M:spot(job) require("file"):spot(job) end
4545

4646
return M

yazi-plugin/preset/plugins/mime.lua

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ local SUPPORTED_TYPES = "application/audio/biosig/chemical/font/image/inode/mess
33
local M = {}
44

55
local function match_mimetype(s)
6-
local type, sub = s:match("([-a-z]+/)([+-.a-zA-Z0-9]+)%s*$")
7-
if type and sub and SUPPORTED_TYPES:find(type, 1, true) then
8-
return type .. sub
6+
local type, sub = s:match("^([-a-z]+/)([+-.a-zA-Z0-9]+)%s*$")
7+
if type and sub and SUPPORTED_TYPES:find(type, 1, true) then
8+
return type:gsub("^x%-", "", 1) .. sub:gsub("^x%-", "", 1)
99
end
1010
end
1111

12-
function M:fetch(args)
12+
function M:fetch(job)
1313
local urls = {}
14-
for _, file in ipairs(args.files) do
14+
for _, file in ipairs(job.files) do
1515
urls[#urls + 1] = tostring(file.url)
1616
end
1717

@@ -44,9 +44,7 @@ function M:fetch(args)
4444
end
4545

4646
valid = match_mimetype(line)
47-
if valid and line:find(valid, 1, true) ~= 1 then
48-
goto continue
49-
elseif valid then
47+
if valid then
5048
j, updates[urls[i]] = j + 1, valid
5149
flush(false)
5250
end

yazi-plugin/preset/plugins/video.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,6 @@ function M:preload()
6262
return status and status.success and 1 or 2
6363
end
6464

65-
function M:spot(args) require("file"):spot(args) end
65+
function M:spot(job) require("file"):spot(job) end
6666

6767
return M

0 commit comments

Comments
 (0)