summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-01-23 04:18:57 +0200
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2024-01-23 13:01:09 +0200
commite0b7cb8e9a8b0fdbd45a54ce2e79a66e4908fc87 (patch)
tree200b7ac93e140175df89f43bf8f4f5c81f6aa1eb
parent90aa7f0042b0793e205a399dcf82a246ed089526 (diff)
Issue #30 Notecard losing thumbnail data
-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;