mirror of
https://github.com/overte-org/overte.git
synced 2025-07-26 08:15:21 +02:00
BUGZ-829 - error handling for web uploaded model files
This commit is contained in:
parent
130e68c9b5
commit
b770ff7b79
2 changed files with 10 additions and 5 deletions
|
@ -2601,14 +2601,16 @@ bool DomainServer::processPendingContent(HTTPConnection* connection, QString ite
|
||||||
}
|
}
|
||||||
QByteArray& _pendingUploadedContent = _pendingUploadedContents[sessionId];
|
QByteArray& _pendingUploadedContent = _pendingUploadedContents[sessionId];
|
||||||
_pendingUploadedContent += dataChunk;
|
_pendingUploadedContent += dataChunk;
|
||||||
connection->respond(HTTPConnection::StatusCode200);
|
|
||||||
|
|
||||||
if (itemName == "restore-file" || itemName == "restore-file-chunk-final" || itemName == "restore-file-chunk-only") {
|
if (itemName == "restore-file" || itemName == "restore-file-chunk-final" || itemName == "restore-file-chunk-only") {
|
||||||
// invoke our method to hand the new octree file off to the octree server
|
// invoke our method to hand the new octree file off to the octree server
|
||||||
QMetaObject::invokeMethod(this, "handleOctreeFileReplacement",
|
if(!handleOctreeFileReplacement(_pendingUploadedContent, filename, QString())) {
|
||||||
Qt::QueuedConnection, Q_ARG(QByteArray, _pendingUploadedContent), Q_ARG(QString, filename), Q_ARG(QString, QString()));
|
connection->respond(HTTPConnection::StatusCode400);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
_pendingUploadedContents.erase(sessionId);
|
_pendingUploadedContents.erase(sessionId);
|
||||||
}
|
}
|
||||||
|
connection->respond(HTTPConnection::StatusCode200);
|
||||||
} else {
|
} else {
|
||||||
connection->respond(HTTPConnection::StatusCode400);
|
connection->respond(HTTPConnection::StatusCode400);
|
||||||
return false;
|
return false;
|
||||||
|
@ -3491,7 +3493,7 @@ void DomainServer::maybeHandleReplacementEntityFile() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DomainServer::handleOctreeFileReplacement(QByteArray octreeFile, QString sourceFilename, QString name) {
|
bool DomainServer::handleOctreeFileReplacement(QByteArray octreeFile, QString sourceFilename, QString name) {
|
||||||
OctreeUtils::RawEntityData data;
|
OctreeUtils::RawEntityData data;
|
||||||
if (data.readOctreeDataInfoFromData(octreeFile)) {
|
if (data.readOctreeDataInfoFromData(octreeFile)) {
|
||||||
data.resetIdAndVersion();
|
data.resetIdAndVersion();
|
||||||
|
@ -3520,11 +3522,14 @@ void DomainServer::handleOctreeFileReplacement(QByteArray octreeFile, QString so
|
||||||
_settingsManager.recurseJSONObjectAndOverwriteSettings(jsonObject, ContentSettings);
|
_settingsManager.recurseJSONObjectAndOverwriteSettings(jsonObject, ContentSettings);
|
||||||
|
|
||||||
QMetaObject::invokeMethod(this, "restart", Qt::QueuedConnection);
|
QMetaObject::invokeMethod(this, "restart", Qt::QueuedConnection);
|
||||||
|
return true;
|
||||||
} else {
|
} else {
|
||||||
qWarning() << "Could not write replacement octree data to file - refusing to process";
|
qWarning() << "Could not write replacement octree data to file - refusing to process";
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "Received replacement octree file that is invalid - refusing to process";
|
qDebug() << "Received replacement octree file that is invalid - refusing to process";
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ private slots:
|
||||||
|
|
||||||
void handleDomainContentReplacementFromURLRequest(QSharedPointer<ReceivedMessage> message);
|
void handleDomainContentReplacementFromURLRequest(QSharedPointer<ReceivedMessage> message);
|
||||||
void handleOctreeFileReplacementRequest(QSharedPointer<ReceivedMessage> message);
|
void handleOctreeFileReplacementRequest(QSharedPointer<ReceivedMessage> message);
|
||||||
void handleOctreeFileReplacement(QByteArray octreeFile, QString sourceFilename, QString name);
|
bool handleOctreeFileReplacement(QByteArray octreeFile, QString sourceFilename, QString name);
|
||||||
|
|
||||||
void processOctreeDataRequestMessage(QSharedPointer<ReceivedMessage> message);
|
void processOctreeDataRequestMessage(QSharedPointer<ReceivedMessage> message);
|
||||||
void processOctreeDataPersistMessage(QSharedPointer<ReceivedMessage> message);
|
void processOctreeDataPersistMessage(QSharedPointer<ReceivedMessage> message);
|
||||||
|
|
Loading…
Reference in a new issue