mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01: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];
|
||||
_pendingUploadedContent += dataChunk;
|
||||
connection->respond(HTTPConnection::StatusCode200);
|
||||
|
||||
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
|
||||
QMetaObject::invokeMethod(this, "handleOctreeFileReplacement",
|
||||
Qt::QueuedConnection, Q_ARG(QByteArray, _pendingUploadedContent), Q_ARG(QString, filename), Q_ARG(QString, QString()));
|
||||
if(!handleOctreeFileReplacement(_pendingUploadedContent, filename, QString())) {
|
||||
connection->respond(HTTPConnection::StatusCode400);
|
||||
return false;
|
||||
}
|
||||
_pendingUploadedContents.erase(sessionId);
|
||||
}
|
||||
connection->respond(HTTPConnection::StatusCode200);
|
||||
} else {
|
||||
connection->respond(HTTPConnection::StatusCode400);
|
||||
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;
|
||||
if (data.readOctreeDataInfoFromData(octreeFile)) {
|
||||
data.resetIdAndVersion();
|
||||
|
@ -3520,11 +3522,14 @@ void DomainServer::handleOctreeFileReplacement(QByteArray octreeFile, QString so
|
|||
_settingsManager.recurseJSONObjectAndOverwriteSettings(jsonObject, ContentSettings);
|
||||
|
||||
QMetaObject::invokeMethod(this, "restart", Qt::QueuedConnection);
|
||||
return true;
|
||||
} else {
|
||||
qWarning() << "Could not write replacement octree data to file - refusing to process";
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
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 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 processOctreeDataPersistMessage(QSharedPointer<ReceivedMessage> message);
|
||||
|
|
Loading…
Reference in a new issue