mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:23:54 +02:00
make sure paths are prepended with a slash
This commit is contained in:
parent
edadaea604
commit
89cb3d66e4
3 changed files with 17 additions and 3 deletions
|
@ -2216,12 +2216,13 @@ void DomainServer::respondToPathQuery(const QByteArray& receivedPacket, const Hi
|
|||
pathQuery.prepend("/");
|
||||
}
|
||||
|
||||
const QString PATHS_SETTINGS_KEYPATH_FORMAT = "paths.%2";
|
||||
const QString PATHS_SETTINGS_KEYPATH_FORMAT = "%1.%2";
|
||||
const QString PATH_VIEWPOINT_KEY = "viewpoint";
|
||||
|
||||
// check out paths in the _configMap to see if we have a match
|
||||
const QVariant* pathMatch = valueForKeyPath(_settingsManager.getSettingsMap(),
|
||||
QString(PATHS_SETTINGS_KEYPATH_FORMAT).arg(pathQuery));
|
||||
QString(PATHS_SETTINGS_KEYPATH_FORMAT).arg(SETTINGS_PATHS_KEY)
|
||||
.arg(pathQuery));
|
||||
if (pathMatch) {
|
||||
// we got a match, respond with the resulting viewpoint
|
||||
auto nodeList = DependencyManager::get<LimitedNodeList>();
|
||||
|
|
|
@ -297,7 +297,18 @@ void DomainServerSettingsManager::updateSetting(const QString& key, const QJsonV
|
|||
}
|
||||
}
|
||||
|
||||
updateSetting(childKey, newValue.toObject()[childKey], thisMap, childDescriptionObject);
|
||||
QString sanitizedKey = childKey;
|
||||
|
||||
if (key == SETTINGS_PATHS_KEY) {
|
||||
// We perform special handling for paths here.
|
||||
// If we got sent a path without a leading slash then we add it.
|
||||
|
||||
if (!sanitizedKey.startsWith("/")) {
|
||||
sanitizedKey.prepend("/");
|
||||
}
|
||||
}
|
||||
|
||||
updateSetting(sanitizedKey, newValue.toObject()[childKey], thisMap, childDescriptionObject);
|
||||
}
|
||||
|
||||
if (settingMap[key].toMap().isEmpty()) {
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
#include <HifiConfigVariantMap.h>
|
||||
#include <HTTPManager.h>
|
||||
|
||||
const QString SETTINGS_PATHS_KEY = "paths";
|
||||
|
||||
class DomainServerSettingsManager : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
|
Loading…
Reference in a new issue