修改升级文件校验。

This commit is contained in:
luocai 2024-10-21 19:35:49 +08:00
parent f230e4cc8b
commit bf3ad2be2f

View File

@ -258,9 +258,10 @@ void Application::upgradeDevice(const QString &file) {
int position = baseName.indexOf(versionPrefix);
if (position < 0 || ((baseName.length() - position) < std::strlen(version))) {
emit newMessage(2, "OTA升级", "文件名格式不合法!");
LOG(error) << "baseName: " << baseName.toStdString() << ", position: " << position;
return;
}
QString firmware = baseName.mid(position, std::strlen(version));
QString firmware = baseName.mid(position);
if (device->isConnected()) {
device->requestOta(firmware, file);
} else {