read redirected path info in MappingRequest

This commit is contained in:
Stephen Birarda 2017-08-15 15:19:20 -07:00
parent 03e952ec38
commit 96672becc6
3 changed files with 18 additions and 1 deletions

View file

@ -314,7 +314,7 @@ void AssetServer::handleGetMappingOperation(ReceivedMessage& message, SharedNode
replyPacket.writePrimitive(wasRedirected);
// include the re-directed path in case the caller needs to make relative path requests for the baked asset
replyPacket.write(bakedAssetPath.toUtf8());
replyPacket.writeString(bakedAssetPath);
} else {
replyPacket.write(QByteArray::fromHex(originalAssetHash.toUtf8()));

View file

@ -87,6 +87,17 @@ void GetMappingRequest::doStart() {
if (!_error) {
_hash = message->read(SHA256_HASH_LENGTH).toHex();
// check the boolean to see if this request got re-directed
quint8 wasRedirected;
message->readPrimitive(&wasRedirected);
_wasRedirected = wasRedirected;
// if it did grab that re-directed path
if (_wasRedirected) {
_redirectedPath = message->readString();
}
}
emit finished(this);
});

View file

@ -53,6 +53,8 @@ public:
GetMappingRequest(const AssetPath& path);
AssetHash getHash() const { return _hash; }
AssetPath getRedirectedPath() const { return _redirectedPath; }
bool wasRedirected() const { return _wasRedirected; }
signals:
void finished(GetMappingRequest* thisRequest);
@ -62,6 +64,10 @@ private:
AssetPath _path;
AssetHash _hash;
AssetPath _redirectedPath;
bool _wasRedirected { false };
};
class SetMappingRequest : public MappingRequest {