Skip to content

Commit

Permalink
setup: Enhance URL Handling to Support Partial Inputs (commaai#30681)
Browse files Browse the repository at this point in the history
* easy urls

* better
  • Loading branch information
royjr authored Dec 27, 2023
1 parent a1f53c7 commit 4df8506
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions selfdrive/ui/qt/setup/setup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ bool is_elf(char *fname) {
}

void Setup::download(QString url) {
// autocomplete incomplete urls
if (QRegularExpression("^([^/.]+)/([^/]+)$").match(url).hasMatch()) {
url.prepend("https://installer.comma.ai/");
}

CURL *curl = curl_easy_init();
if (!curl) {
emit finished(url, tr("Something went wrong. Reboot the device."));
Expand Down

0 comments on commit 4df8506

Please sign in to comment.