Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions src/lib/data-transfer/core/utils/settinghepler.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#include "settinghepler.h"
// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

#include "settinghepler.h"

#include "common/log.h"

Check warning on line 7 in src/lib/data-transfer/core/utils/settinghepler.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: "common/log.h" not found.

#include <net/helper/transferhepler.h>

Expand Down Expand Up @@ -71,7 +75,7 @@

QDir pdir(path);
QString filepath = pdir.absolutePath() + "/";
QJsonObject jsonObj = ParseJson(filepath + "transfer.json");
QJsonObject jsonObj = ParseJson(QDir(filepath).filePath("transfer.json"));
if (jsonObj.isEmpty()) {
addTaskcounter(-1);
WLOG << "transfer.json is invaild";
Expand Down Expand Up @@ -100,8 +104,10 @@
}
}
addTaskcounter(-1);
//remove dir
pdir.removeRecursively();
//remove transfer.json
const QString jsonFile = QDir(filepath).filePath("transfer.json");
if (!QFile::remove(jsonFile))
WLOG << "Failed to remove transfer.json: " << jsonFile.toStdString();
return true;
}

Expand Down Expand Up @@ -309,8 +315,11 @@
const QJsonArray &userFileArray = userFileValue.toArray();
for (const auto &value : userFileArray) {
QString filename = value.toString();

// 只保留文件名部分,兼容相对路径和绝对路径格式
QString file = filepath + QFileInfo(filename).fileName();

QString targetFile = QDir::homePath() + "/" + filename;
QString file = filepath + filename.mid(filename.indexOf('/') + 1);
QFileInfo info = QFileInfo(targetFile);
auto dir = info.dir();
if (!dir.exists())
Expand Down
Loading