mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 11:28:03 +02:00
Merge pull request #9474 from birarda/bug/web-entity-safe-url
use fromUserInput to avoid web entity crashes with bad URLs
This commit is contained in:
commit
c8d505c482
2 changed files with 16 additions and 9 deletions
|
@ -246,14 +246,14 @@ void RenderableWebEntityItem::render(RenderArgs* args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderableWebEntityItem::setSourceUrl(const QString& value) {
|
void RenderableWebEntityItem::setSourceUrl(const QString& value) {
|
||||||
if (_sourceUrl != value) {
|
auto valueBeforeSuperclassSet = _sourceUrl;
|
||||||
qCDebug(entities) << "Setting web entity source URL to " << value;
|
|
||||||
_sourceUrl = value;
|
WebEntityItem::setSourceUrl(value);
|
||||||
if (_webSurface) {
|
|
||||||
AbstractViewStateInterface::instance()->postLambdaEvent([this] {
|
if (_sourceUrl != valueBeforeSuperclassSet && _webSurface) {
|
||||||
_webSurface->getRootItem()->setProperty("url", _sourceUrl);
|
AbstractViewStateInterface::instance()->postLambdaEvent([this] {
|
||||||
});
|
_webSurface->getRootItem()->setProperty("url", _sourceUrl);
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,14 @@ bool WebEntityItem::findDetailedRayIntersection(const glm::vec3& origin, const g
|
||||||
|
|
||||||
void WebEntityItem::setSourceUrl(const QString& value) {
|
void WebEntityItem::setSourceUrl(const QString& value) {
|
||||||
if (_sourceUrl != 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.";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue