summaryrefslogtreecommitdiff
path: root/indra/llinventory
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2024-02-05 22:09:54 +0200
committerGitHub <noreply@github.com>2024-02-05 22:09:54 +0200
commit9f0faf5c892bba9703c713a29202a8ac48bfdf8b (patch)
tree8e64e6074c11005fbb1dac606c176e4470de03e4 /indra/llinventory
parentaa52c852d600aa6b2ea17cdd86f53972c95cca4a (diff)
parente3e1672ac40dd4f1f4e458ed09cd7279f0a45fc3 (diff)
Merge pull request #735 from secondlife/marchcat/yz-merge
Merge Maint Z into Maint YZ
Diffstat (limited to 'indra/llinventory')
-rw-r--r--indra/llinventory/llinventory.cpp55
1 files changed, 50 insertions, 5 deletions
diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp
index 55bcc7c5b2..6334a35fd0 100644
--- a/indra/llinventory/llinventory.cpp
+++ b/indra/llinventory/llinventory.cpp
@@ -32,6 +32,7 @@
#include "llinventorydefines.h"
#include "llxorcipher.h"
#include "llsd.h"
+#include "llsdserialize.h"
#include "message.h"
#include <boost/tokenizer.hpp>
@@ -217,7 +218,19 @@ BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream)
}
else if (0 == strcmp("metadata", keyword))
{
- LLSD metadata(valuestr);
+ LLSD metadata;
+ if (strncmp("<llsd>", valuestr, 6) == 0)
+ {
+ std::istringstream stream(valuestr);
+ LLSDSerialize::fromXML(metadata, stream);
+ }
+ else
+ {
+ // next line likely contains metadata, but at the moment is not supported
+ // can do something like:
+ // LLSDSerialize::fromNotation(metadata, input_stream, -1);
+ }
+
if (metadata.has("thumbnail"))
{
const LLSD& thumbnail = metadata["thumbnail"];
@@ -693,7 +706,19 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream)
}
else if (0 == strcmp("metadata", keyword))
{
- LLSD metadata(valuestr);
+ LLSD metadata;
+ if (strncmp("<llsd>", valuestr, 6) == 0)
+ {
+ std::istringstream stream(valuestr);
+ LLSDSerialize::fromXML(metadata, stream);
+ }
+ else
+ {
+ // next line likely contains metadata, but at the moment is not supported
+ // can do something like:
+ // LLSDSerialize::fromNotation(metadata, input_stream, -1);
+ }
+
if (metadata.has("thumbnail"))
{
const LLSD& thumbnail = metadata["thumbnail"];
@@ -802,9 +827,14 @@ BOOL LLInventoryItem::exportLegacyStream(std::ostream& output_stream, BOOL inclu
if (mThumbnailUUID.notNull())
{
+ // Max length is 255 chars, will have to export differently if it gets more data
+ // Ex: use newline and toNotation (uses {}) for unlimited size
LLSD metadata;
metadata["thumbnail"] = LLSD().with("asset_id", mThumbnailUUID);
- output_stream << "\t\tmetadata\t" << metadata << "|\n";
+
+ output_stream << "\t\tmetadata\t";
+ LLSDSerialize::toXML(metadata, output_stream);
+ output_stream << "|\n";
}
// Check for permissions to see the asset id, and if so write it
@@ -1303,7 +1333,19 @@ BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream)
}
else if (0 == strcmp("metadata", keyword))
{
- LLSD metadata(valuestr);
+ LLSD metadata;
+ if (strncmp("<llsd>", valuestr, 6) == 0)
+ {
+ std::istringstream stream(valuestr);
+ LLSDSerialize::fromXML(metadata, stream);
+ }
+ else
+ {
+ // next line likely contains metadata, but at the moment is not supported
+ // can do something like:
+ // LLSDSerialize::fromNotation(metadata, input_stream, -1);
+ }
+
if (metadata.has("thumbnail"))
{
const LLSD& thumbnail = metadata["thumbnail"];
@@ -1343,9 +1385,12 @@ BOOL LLInventoryCategory::exportLegacyStream(std::ostream& output_stream, BOOL)
output_stream << "\t\tname\t" << mName.c_str() << "|\n";
if (mThumbnailUUID.notNull())
{
+ // Only up to 255 chars
LLSD metadata;
metadata["thumbnail"] = LLSD().with("asset_id", mThumbnailUUID);
- output_stream << "\t\tmetadata\t" << metadata << "|\n";
+ output_stream << "\t\tmetadata\t";
+ LLSDSerialize::toXML(metadata, output_stream);
+ output_stream << "|\n";
}
output_stream << "\t}\n";
return TRUE;