mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
Add more check
This commit is contained in:
parent
a1339aad2b
commit
6809e9dcef
3 changed files with 21 additions and 7 deletions
|
|
@ -1,8 +1,12 @@
|
|||
local M = {}
|
||||
|
||||
function M:peek()
|
||||
local cache = ya.file_cache(self)
|
||||
ya.image_show(fs.symlink_metadata(cache) and cache or self.file.url, self.area)
|
||||
local url = ya.file_cache(self)
|
||||
if not url or not fs.symlink_metadata(url) then
|
||||
url = self.file.url
|
||||
end
|
||||
|
||||
ya.image_show(url, self.area)
|
||||
ya.preview_widgets(self, {})
|
||||
end
|
||||
|
||||
|
|
@ -10,7 +14,7 @@ function M:seek() end
|
|||
|
||||
function M:preload()
|
||||
local cache = ya.file_cache(self)
|
||||
if fs.symlink_metadata(cache) then
|
||||
if not cache or fs.symlink_metadata(cache) then
|
||||
return 1
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,13 @@
|
|||
local M = {}
|
||||
|
||||
function M:peek()
|
||||
local cache = ya.file_cache(self)
|
||||
if not cache then
|
||||
return
|
||||
end
|
||||
|
||||
if self:preload() == 1 then
|
||||
ya.image_show(ya.file_cache(self), self.area)
|
||||
ya.image_show(cache, self.area)
|
||||
ya.preview_widgets(self, {})
|
||||
end
|
||||
end
|
||||
|
|
@ -17,7 +22,7 @@ end
|
|||
|
||||
function M:preload()
|
||||
local cache = ya.file_cache(self)
|
||||
if fs.symlink_metadata(cache) then
|
||||
if not cache or fs.symlink_metadata(cache) then
|
||||
return 1
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,13 @@
|
|||
local M = {}
|
||||
|
||||
function M:peek()
|
||||
local cache = ya.file_cache(self)
|
||||
if not cache then
|
||||
return
|
||||
end
|
||||
|
||||
if self:preload() == 1 then
|
||||
ya.image_show(ya.file_cache(self), self.area)
|
||||
ya.image_show(cache, self.area)
|
||||
ya.preview_widgets(self, {})
|
||||
end
|
||||
end
|
||||
|
|
@ -25,7 +30,7 @@ function M:preload()
|
|||
end
|
||||
|
||||
local cache = ya.file_cache(self)
|
||||
if fs.symlink_metadata(cache) then
|
||||
if not cache or fs.symlink_metadata(cache) then
|
||||
return 1
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue