mirror of
https://github.com/lubosz/overte.git
synced 2025-04-16 09:29:16 +02:00
Fix DS assignment scripts responses
This commit is contained in:
parent
822244ef72
commit
9330c3d4f3
1 changed files with 8 additions and 8 deletions
|
@ -1171,7 +1171,6 @@ bool DomainServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url
|
|||
const QString JSON_MIME_TYPE = "application/json";
|
||||
|
||||
const QString URI_ASSIGNMENT = "/assignment";
|
||||
const QString URI_ASSIGNMENT_SCRIPTS = URI_ASSIGNMENT + "/scripts";
|
||||
const QString URI_NODES = "/nodes";
|
||||
const QString URI_SETTINGS = "/settings";
|
||||
|
||||
|
@ -1212,13 +1211,14 @@ bool DomainServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url
|
|||
if (matchingAssignment && matchingAssignment->getType() == Assignment::AgentType) {
|
||||
// we have a matching assignment and it is for the right type, have the HTTP manager handle it
|
||||
// via correct URL for the script so the client can download
|
||||
|
||||
QUrl scriptURL = url;
|
||||
scriptURL.setPath(URI_ASSIGNMENT + "/scripts/"
|
||||
+ uuidStringWithoutCurlyBraces(matchingAssignment->getUUID()));
|
||||
|
||||
// have the HTTPManager serve the appropriate script file
|
||||
return _httpManager.handleHTTPRequest(connection, scriptURL, true);
|
||||
QFile scriptFile(pathForAssignmentScript(matchingAssignment->getUUID()));
|
||||
|
||||
if (scriptFile.exists() && scriptFile.open(QIODevice::ReadOnly)) {
|
||||
connection->respond(HTTPConnection::StatusCode200, scriptFile.readAll(), "application/javascript");
|
||||
} else {
|
||||
connection->respond(HTTPConnection::StatusCode404, "Resource not found.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// request not handled
|
||||
|
|
Loading…
Reference in a new issue