fix path lenght for ecryptfs
This commit is contained in:
@@ -600,8 +600,8 @@ class ShowWorker(QtCore.QThread):
|
||||
name = path.split("/")[-1]
|
||||
if name and path.startswith("http"):
|
||||
storename = os.path.join(store, name)
|
||||
if len(storename) >= 260:
|
||||
remainChars = 259 - (len(store) + len(wbName) + 1)
|
||||
if len(storename) >= fscharlimit:
|
||||
remainChars = (fscharlimit - 1) - (len(store) + len(wbName) + 1)
|
||||
storename = os.path.join(store, wbName+name[-remainChars:])
|
||||
if not os.path.exists(storename):
|
||||
try:
|
||||
@@ -611,13 +611,17 @@ class ShowWorker(QtCore.QThread):
|
||||
except Exception:
|
||||
print("AddonManager: Debug: Error retrieving image from", path)
|
||||
else:
|
||||
f = open(storename, "wb")
|
||||
f.write(imagedata)
|
||||
f.close()
|
||||
|
||||
# resize the image to 300x300px if needed
|
||||
img = QtGui.QImage(storename)
|
||||
if (img.width() > 300) or (img.height() > 300):
|
||||
try:
|
||||
f = open(storename, "wb")
|
||||
except OSError:
|
||||
# ecryptfs (and probably not only ecryptfs) has lower length limit for path
|
||||
storename = storename[-140:]
|
||||
f = open(storename, "wb")
|
||||
f.write(imagedata)
|
||||
f.close()
|
||||
# resize the image to 300x300px if needed
|
||||
img = QtGui.QImage(storename)
|
||||
if (img.width() > 300) or (img.height() > 300):
|
||||
pix = QtGui.QPixmap()
|
||||
pix = pix.fromImage(img.scaled(300, 300,
|
||||
QtCore.Qt.KeepAspectRatio,
|
||||
|
||||
Reference in New Issue
Block a user