Skip to content

Commit

Permalink
fix: When restoring files with long file names from trash, the prompt…
Browse files Browse the repository at this point in the history
… window icon and file size display error for replacing existing files

Create a fileinfo using the scheme of trash, retrieve the restored original path, and recreate the fileinfo

Log: When restoring files with long file names from trash, the prompt window icon and file size display error for replacing existing files
Bug: https://pms.uniontech.com/bug-view-259587.html
  • Loading branch information
liyigang1 authored and max-lvs committed Jun 19, 2024
1 parent 9adc344 commit f614642
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,6 @@ void FileOperateBaseWorker::initCopyWay()

QUrl FileOperateBaseWorker::trashInfo(const DFileInfoPointer &fromInfo)
{

auto parentPath = parentUrl(fromInfo->uri()).path();
if (!parentPath.endsWith("files"))
return QUrl();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,11 @@ bool DoRestoreTrashFilesWorker::doRestoreTrashFiles()
}
}
DFileInfoPointer fileInfo { new DFileInfo(url) };

// read trash info
QUrl trashInfoUrl { fileInfo->attribute(DFileInfo::AttributeID::kStandardTargetUri).toString().replace("/files/", "/info/") + ".trashinfo" };
QUrl trashUrl = QUrl(fileInfo->attribute(DFileInfo::AttributeID::kStandardTargetUri).toString());
fileInfo.reset(new DFileInfo(trashUrl));
const QString &trashInfoCache { DFMIO::DFile(trashInfoUrl).readAll() };
emitCurrentTaskNotify(url, restoreInfo->uri());
bool ok = false;
Expand Down

0 comments on commit f614642

Please sign in to comment.