Fail early when parsing an empty addon name from the url

This commit is contained in:
woblight
2023-05-08 21:50:20 +02:00
parent ebb7a524e4
commit b7464922d5
+4
View File
@@ -373,6 +373,10 @@ void Control::clone(QUrl url, int i)
QString error;
} data;
data.name = url.fileName().section('.',0,0);
if (data.name.isEmpty()) {
data.error = QString("Invalid url.");
return data;
}
git_clone_options opts = GIT_CLONE_OPTIONS_INIT;
opts.fetch_opts.callbacks.transfer_progress = &clone_progress_cb;
int error = git_clone(&data.repo, url.toString().toLocal8Bit(), (m_addonsPaths[i] + "/" + data.name).toLocal8Bit(), &opts);