Skip to content

Commit 854d849

Browse files
Merge pull request #16511 from howard-stearns/fix-lookupurl-helper-regex
fix handleUrl helper regex
2 parents 065614b + 2cc39a2 commit 854d849

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

libraries/networking/src/AddressManager.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,10 @@ bool AddressManager::handleUrl(const QUrl& lookupUrlIn, LookupTrigger trigger) {
242242

243243
QUrl lookupUrl = lookupUrlIn;
244244

245-
qCDebug(networking) << "Trying to go to URL" << lookupUrl.toString();
245+
if (!lookupUrl.host().isEmpty() && !lookupUrl.path().isEmpty()) {
246+
// Assignment clients ping for empty url until assigned. Don't spam.
247+
qCDebug(networking) << "Trying to go to URL" << lookupUrl.toString();
248+
}
246249

247250
if (lookupUrl.scheme().isEmpty() && !lookupUrl.path().startsWith("/")) {
248251
// 'urls' without schemes are taken as domain names, as opposed to
@@ -263,8 +266,8 @@ bool AddressManager::handleUrl(const QUrl& lookupUrlIn, LookupTrigger trigger) {
263266
if (lookupUrl.scheme() == URL_SCHEME_HIFI) {
264267
if (lookupUrl.host().isEmpty()) {
265268
// this was in the form hifi:/somewhere or hifi:somewhere. Fix it by making it hifi://somewhere
266-
static const QRegExp HIFI_SCHEME_REGEX = QRegExp(URL_SCHEME_HIFI + ":\\/?", Qt::CaseInsensitive);
267-
lookupUrl = QUrl(lookupUrl.toString().replace(HIFI_SCHEME_REGEX, URL_SCHEME_HIFI + "://"));
269+
static const QRegExp HIFI_SCHEME_REGEX = QRegExp(URL_SCHEME_HIFI + ":\\/?($|\\w+)", Qt::CaseInsensitive);
270+
lookupUrl = QUrl(lookupUrl.toString().replace(HIFI_SCHEME_REGEX, URL_SCHEME_HIFI + "://\\1"));
268271
}
269272

270273
DependencyManager::get<NodeList>()->flagTimeForConnectionStep(LimitedNodeList::ConnectionStep::LookupAddress);

0 commit comments

Comments
 (0)