Open .ton as a tonsite.

This commit is contained in:
John Preston
2024-07-31 18:59:31 +02:00
parent a422aec99a
commit 148690d8b1
4 changed files with 18 additions and 5 deletions

View File

@@ -166,12 +166,16 @@ namespace {
};
auto parsed = QUrl(value);
if (parsed.isValid()) {
const auto host = ChangeHost(parsed.host());
const auto emptyPath = parsed.path().isEmpty();
parsed.setScheme("tonsite");
parsed.setHost(ChangeHost(parsed.host()));
if (parsed.path().isEmpty()) {
parsed.setHost(host);
if (emptyPath) {
parsed.setPath(u"/"_q);
}
return parsed.toString();
if (parsed.isValid()) {
return parsed.toString();
}
}
const auto part = value.mid(u"https://"_q.size());
const auto split = part.indexOf('/');