From 81ba875ad2e1b8c968de701232f44cf87f03b8a7 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Thu, 5 Apr 2018 12:39:49 -0700 Subject: [PATCH] currentShareableAddress wont return file: urls. copy-current-address menu item uses non-shareable version --- libraries/networking/src/AddressManager.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/libraries/networking/src/AddressManager.cpp b/libraries/networking/src/AddressManager.cpp index 7d7c2e682b..541b564317 100644 --- a/libraries/networking/src/AddressManager.cpp +++ b/libraries/networking/src/AddressManager.cpp @@ -60,6 +60,7 @@ QUrl AddressManager::currentFacingAddress() const { } QUrl AddressManager::currentShareableAddress(bool domainOnly) const { + QUrl shareableAddress; if (!_shareablePlaceName.isEmpty()) { // if we have a shareable place name use that instead of whatever the current host is QUrl hifiURL; @@ -71,10 +72,16 @@ QUrl AddressManager::currentShareableAddress(bool domainOnly) const { hifiURL.setPath(currentPath()); } - return hifiURL; + shareableAddress = hifiURL; } else { - return currentAddress(domainOnly); + shareableAddress = currentAddress(domainOnly); } + + if (shareableAddress.scheme() == URL_SCHEME_HIFI) { + return QUrl(); // file: urls aren't shareable + } + + return shareableAddress; } QUrl AddressManager::currentFacingShareableAddress() const { @@ -288,6 +295,7 @@ bool AddressManager::handleUrl(const QUrl& lookupUrl, LookupTrigger trigger) { // lookupUrl.scheme() == URL_SCHEME_HTTP || // lookupUrl.scheme() == URL_SCHEME_HTTPS || _previousLookup.clear(); + _shareablePlaceName.clear(); QUrl domainURL = PathUtils::expandToLocalDataAbsolutePath(lookupUrl); setDomainInfo(domainURL, trigger); emit lookupResultsFinished(); @@ -818,7 +826,7 @@ void AddressManager::copyAddress() { } // assume that the address is being copied because the user wants a shareable address - QGuiApplication::clipboard()->setText(currentShareableAddress().toString()); + QGuiApplication::clipboard()->setText(currentFacingAddress().toString()); } void AddressManager::copyPath() {