Skip to content

Commit

Permalink
"[FileCommander]" broken symbolic links - Fix FileTransferTask for br…
Browse files Browse the repository at this point in the history
…oken symbolic links - Fix keyHashes for broken symbolic links
  • Loading branch information
GhostofGeeeee authored and fairbird committed Feb 13, 2025
1 parent 4644aa8 commit ea2058c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/python/Plugins/Extensions/FileCommander/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -941,8 +941,8 @@ def keyGoBottom(self):
def keyHashes(self, path=None):
if path is None:
path = self.sourceColumn.getPath()
if isfile(path):
if stat(path).st_size < HASH_CHECK_SIZE:
if isfile(path) or islink(path):
if lstat(path).st_size < HASH_CHECK_SIZE:
import hashlib
data = {}
data["Screen"] = "FileCommanderHashes"
Expand Down Expand Up @@ -2884,7 +2884,7 @@ def __init__(self, srcPaths, title):
count = len(srcPaths)
for index, srcPath in enumerate(srcPaths):
taskName = _("Directory/File %d of %d" % (index + 1, count))
if isfile(srcPath):
if isfile(srcPath) or islink(srcPath):
FileTransferTask(self, taskName, srcPath, dirname(normpath(srcPath)), FileTransferTask.JOB_DELETE)
else:
FileTransferTask(self, taskName, srcPath, dirname(normpath(srcPath)), FileTransferTask.JOB_DELETE_TREE)
Expand Down Expand Up @@ -2915,7 +2915,7 @@ class FileTransferTask(Task):

def __init__(self, job, taskName, srcPath, dstPath, jobType):
Task.__init__(self, job, taskName)
if exists(srcPath) and exists(dstPath):
if lexists(srcPath) and exists(dstPath):
self.srcPath = srcPath
self.dstPath = dstPath
target = join(dstPath, "") if isdir(srcPath) else join(dstPath, basename(normpath(srcPath)))
Expand Down Expand Up @@ -2954,7 +2954,7 @@ def progressUpdate(self):
self.progressTimer.start(self.updateTime, True)

def prepare(self):
self.srcSize = float(self.dirSize(self.srcPath) if isdir(self.srcPath) else getsize(self.srcPath))
self.srcSize = float(self.dirSize(self.srcPath) if isdir(self.srcPath) else lstat(self.srcPath).st_size)
self.updateTime = max(1000, int(self.srcSize * 0.000001 * 0.5)) # Based on 20Mb/s transfer rate.
self.progressTimer.start(self.updateTime, True)

Expand Down

0 comments on commit ea2058c

Please sign in to comment.