FolderView: More robust drop url generation

In order to generate a correct url as the dropUrl pass the mappedUrl
(with the local part removed) as path for the base url

BUG:521713


(cherry picked from commit 22788f4199)

22788f41 FolderView: More robust drop url generation

Co-authored-by: Marco Martin <notmart@gmail.com>
This commit is contained in:
Marco Martin 2026-06-29 17:09:52 +02:00
parent e4955cf007
commit 6e8368620e

View file

@ -1308,11 +1308,12 @@ void FolderModel::drop(QQuickItem *target, QObject *dropEvent, int row, bool sho
if (dropTargetUrl != m_dirModel->dirLister()->url()) {
QString mappedUrl = url.toString();
const auto local = dropTargetUrl.toString();
const auto internal = m_dirModel->dirLister()->url().toString();
auto internal = m_dirModel->dirLister()->url();
if (mappedUrl.startsWith(local)) {
mappedUrl.replace(0, local.size(), internal);
mappedUrl.replace(0, local.size(), QString());
}
return ScreenMapper::stringToUrl(mappedUrl);
internal.setPath(mappedUrl);
return ScreenMapper::stringToUrl(internal.toString());
}
return url;
};