diff --git a/libraries/entities-renderer/src/RenderableWebEntityItem.cpp b/libraries/entities-renderer/src/RenderableWebEntityItem.cpp index 4fdb6c84dd..7f68738bd5 100644 --- a/libraries/entities-renderer/src/RenderableWebEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableWebEntityItem.cpp @@ -246,14 +246,14 @@ void RenderableWebEntityItem::render(RenderArgs* args) { } void RenderableWebEntityItem::setSourceUrl(const QString& value) { - if (_sourceUrl != value) { - qCDebug(entities) << "Setting web entity source URL to " << value; - _sourceUrl = value; - if (_webSurface) { - AbstractViewStateInterface::instance()->postLambdaEvent([this] { - _webSurface->getRootItem()->setProperty("url", _sourceUrl); - }); - } + auto valueBeforeSuperclassSet = _sourceUrl; + + WebEntityItem::setSourceUrl(value); + + if (_sourceUrl != valueBeforeSuperclassSet && _webSurface) { + AbstractViewStateInterface::instance()->postLambdaEvent([this] { + _webSurface->getRootItem()->setProperty("url", _sourceUrl); + }); } } diff --git a/libraries/entities/src/WebEntityItem.cpp b/libraries/entities/src/WebEntityItem.cpp index 735ec1812a..38ececefa4 100644 --- a/libraries/entities/src/WebEntityItem.cpp +++ b/libraries/entities/src/WebEntityItem.cpp @@ -125,7 +125,14 @@ bool WebEntityItem::findDetailedRayIntersection(const glm::vec3& origin, const g void WebEntityItem::setSourceUrl(const QString& value) { if (_sourceUrl != value) { - _sourceUrl = value; + auto newURL = QUrl::fromUserInput(value); + + if (newURL.isValid()) { + _sourceUrl = newURL.toDisplayString(); + qCDebug(entities) << "Changed web entity source URL to " << _sourceUrl; + } else { + qCDebug(entities) << "Clearing web entity source URL since" << value << "cannot be parsed to a valid URL."; + } } }