From 7498b97251e1e37e0b2be3efd72f1ea6df844e23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E9=9B=85=20=C2=B7=20Misaki=20Masa?= Date: Tue, 10 Dec 2024 01:03:01 +0800 Subject: [PATCH] fix: correctly handle CRLF on Windows in preset `archive` and `json` plugins (#2017) --- yazi-plugin/preset/plugins/archive.lua | 2 +- yazi-plugin/preset/plugins/json.lua | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/yazi-plugin/preset/plugins/archive.lua b/yazi-plugin/preset/plugins/archive.lua index bf412224..a199a9b7 100644 --- a/yazi-plugin/preset/plugins/archive.lua +++ b/yazi-plugin/preset/plugins/archive.lua @@ -110,7 +110,7 @@ function M.list_files(args, skip, limit) goto continue end - key, value = next:match("^(%u%l+) = (.+)[\r\n]+") + key, value = next:match("^(%u%l+) = (.-)[\r\n]+") if key == "Path" then files[#files].path = value elseif key == "Size" then diff --git a/yazi-plugin/preset/plugins/json.lua b/yazi-plugin/preset/plugins/json.lua index a6c1b855..9ecee22b 100644 --- a/yazi-plugin/preset/plugins/json.lua +++ b/yazi-plugin/preset/plugins/json.lua @@ -2,12 +2,7 @@ local M = {} function M:peek(job) local child = Command("jq") - :args({ - "-C", - "--tab", - ".", - tostring(job.file.url), - }) + :args({ "-b", "-C", "--tab", ".", tostring(job.file.url) }) :stdout(Command.PIPED) :stderr(Command.PIPED) :spawn()