summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2026-06-06 00:01:19 +0300
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2026-06-09 00:26:52 +0300
commit6a61d7e25f5408e2b9c966070bc5a5886c41641f (patch)
tree9cdd9c4ce1ec2bbd9961daa44d9470a8dd09f7e7 /indra
parent5543a2a6cb5d4b2405f5f2d581c3917a0f60b8f8 (diff)
p575 Unify description field
Diffstat (limited to 'indra')
-rw-r--r--indra/llinventory/llinventory.cpp44
-rw-r--r--indra/llui/lltextvalidate.cpp12
-rw-r--r--indra/llui/lltextvalidate.h2
-rw-r--r--indra/newview/skins/default/xui/en/floater_create_landmark.xml2
-rw-r--r--indra/newview/skins/default/xui/en/panel_landmark_info.xml2
-rw-r--r--indra/newview/skins/default/xui/en/sidepanel_item_info.xml2
-rw-r--r--indra/newview/skins/default/xui/en/strings.xml2
7 files changed, 54 insertions, 12 deletions
diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp
index f126accfb8..2f60e3bead 100644
--- a/indra/llinventory/llinventory.cpp
+++ b/indra/llinventory/llinventory.cpp
@@ -33,6 +33,7 @@
#include "llxorcipher.h"
#include "llsd.h"
#include "llsdserialize.h"
+#include "llstreamtools.h"
#include "message.h"
#include <boost/tokenizer.hpp>
@@ -827,6 +828,42 @@ bool LLInventoryItem::importLegacyStream(std::istream& input_stream)
}
mDescription.assign(valuestr);
+
+ // Currently server side doesn't handle escaped newline right
+ // and they end up unescaped.
+ // And even if we do copy the data correctly, moving the item
+ // from notecard using CopyInventoryFromNotecard drops the
+ // content after first the new line.
+ //
+ // Check if the description ends with | on this line
+ if (strchr(buffer, '|') == nullptr)
+ {
+ // No | found, continue reading lines until we find one
+ char next_buffer[MAX_STRING];
+ while (input_stream.good())
+ {
+ input_stream.getline(next_buffer, MAX_STRING);
+
+ // Look for | delimiter
+ char* pipe_pos = strchr(next_buffer, '|');
+ if (pipe_pos != nullptr)
+ {
+ // Found the delimiter, add text up to it
+ *pipe_pos = '\0'; // Terminate at the pipe
+ mDescription += '\n';
+ mDescription += next_buffer;
+ break;
+ }
+ else
+ {
+ // No delimiter yet, add the whole line
+ mDescription += '\n';
+ mDescription += next_buffer;
+ }
+ }
+ }
+
+ unescape_string(mDescription);
LLStringUtil::replaceNonstandardASCII(mDescription, ' ');
/* TODO -- ask Ian about this code
const char *donkey = mDescription.c_str();
@@ -920,7 +957,12 @@ bool LLInventoryItem::exportLegacyStream(std::ostream& output_stream, bool inclu
output_stream << buffer;
mSaleInfo.exportLegacyStream(output_stream);
output_stream << "\t\tname\t" << mName.c_str() << "|\n";
- output_stream << "\t\tdesc\t" << mDescription.c_str() << "|\n";
+ // Note: Currently server side doesn't handle newline right for notecards.
+ // Even if we escape or replace all newlines with spaces, notecard's
+ // import buffer still ends up with newlines.
+ std::string desc = mDescription;
+ escape_string(desc);
+ output_stream << "\t\tdesc\t" << desc.c_str() << "|\n";
output_stream << "\t\tcreation_date\t" << mCreationDate << "\n";
output_stream << "\t}\n";
return true;
diff --git a/indra/llui/lltextvalidate.cpp b/indra/llui/lltextvalidate.cpp
index 9a087d8230..1f2e7e65db 100644
--- a/indra/llui/lltextvalidate.cpp
+++ b/indra/llui/lltextvalidate.cpp
@@ -434,7 +434,7 @@ public:
} validatorASCIINoLeadingSpaceImpl;
Validator validateASCIINoLeadingSpace(validatorASCIINoLeadingSpaceImpl);
-class ValidatorASCIIWithNewLine : public ValidatorImpl
+class ValidatorASCIIWithNewLineNoPipe : public ValidatorImpl
{
// Used for multiline text stored on the server.
// Example is landmark description in Places SP.
@@ -446,9 +446,9 @@ class ValidatorASCIIWithNewLine : public ValidatorImpl
{
CHAR ch = str[len];
- if ((ch < 0x20 && ch != 0xA) || ch > 0x7f)
+ if ((ch < 0x20 && ch != 0xA) || ch > 0x7f || ch == '|')
{
- return setError("Validator_ShouldBeNewLineOrASCII", LLSD().with("NR", len + 1).with("CH", llsd(ch)));
+ return setError("Validator_ShouldBeNewLineOrASCIINoPipe", LLSD().with("NR", len + 1).with("CH", llsd(ch)));
}
}
@@ -458,8 +458,8 @@ class ValidatorASCIIWithNewLine : public ValidatorImpl
public:
/*virtual*/ bool validate(const std::string& str) override { return validate<char>(str); }
/*virtual*/ bool validate(const LLWString& str) override { return validate<llwchar>(str); }
-} validatorASCIIWithNewLineImpl;
-Validator validateASCIIWithNewLine(validatorASCIIWithNewLineImpl);
+} validatorASCIIWithNewLineNoPipeImpl;
+Validator validateASCIIWithNewLineNoPipe(validatorASCIIWithNewLineNoPipeImpl);
void Validators::declareValues()
{
@@ -472,7 +472,7 @@ void Validators::declareValues()
declare("alpha_num_space", validateAlphaNumSpace);
declare("ascii_printable_no_pipe", validateASCIIPrintableNoPipe);
declare("ascii_printable_no_space", validateASCIIPrintableNoSpace);
- declare("ascii_with_newline", validateASCIIWithNewLine);
+ declare("ascii_with_newline_no_pipe", validateASCIIWithNewLineNoPipe);
}
} // namespace LLTextValidate
diff --git a/indra/llui/lltextvalidate.h b/indra/llui/lltextvalidate.h
index 096c28b448..a95f79bfcb 100644
--- a/indra/llui/lltextvalidate.h
+++ b/indra/llui/lltextvalidate.h
@@ -88,7 +88,7 @@ namespace LLTextValidate
extern Validator validateASCIIPrintableNoSpace;
extern Validator validateASCII;
extern Validator validateASCIINoLeadingSpace;
- extern Validator validateASCIIWithNewLine;
+ extern Validator validateASCIIWithNewLineNoPipe;
// Add available validators to the internal map
struct Validators : public LLInitParam::TypeValuesHelper<Validator, Validators>
diff --git a/indra/newview/skins/default/xui/en/floater_create_landmark.xml b/indra/newview/skins/default/xui/en/floater_create_landmark.xml
index 6d3da72962..343325c124 100644
--- a/indra/newview/skins/default/xui/en/floater_create_landmark.xml
+++ b/indra/newview/skins/default/xui/en/floater_create_landmark.xml
@@ -87,7 +87,7 @@
name="notes_editor"
spellcheck="true"
text_readonly_color="white"
- prevalidator="ascii"
+ prevalidator="ascii_with_newline_no_pipe"
commit_on_focus_lost="true"
top_pad="5"
width="290"
diff --git a/indra/newview/skins/default/xui/en/panel_landmark_info.xml b/indra/newview/skins/default/xui/en/panel_landmark_info.xml
index 19599efdc2..bd3f66115e 100644
--- a/indra/newview/skins/default/xui/en/panel_landmark_info.xml
+++ b/indra/newview/skins/default/xui/en/panel_landmark_info.xml
@@ -336,7 +336,7 @@
read_only="true"
spellcheck="true"
text_readonly_color="white"
- prevalidator="ascii_with_newline"
+ prevalidator="ascii_with_newline_no_pipe"
top_pad="5"
width="290"
wrap="true" />
diff --git a/indra/newview/skins/default/xui/en/sidepanel_item_info.xml b/indra/newview/skins/default/xui/en/sidepanel_item_info.xml
index 40a88d4121..5f97f27db6 100644
--- a/indra/newview/skins/default/xui/en/sidepanel_item_info.xml
+++ b/indra/newview/skins/default/xui/en/sidepanel_item_info.xml
@@ -212,7 +212,7 @@ TestString PleaseIgnore
Description:
</text>
<text_editor
- prevalidator="ascii_printable_no_pipe"
+ prevalidator="ascii_with_newline_no_pipe"
commit_on_focus_lost="true"
border_style="line"
border_thickness="1"
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index a6fb6db63d..a8fa4b735a 100644
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -598,7 +598,7 @@ http://secondlife.com/support for help fixing this problem.
<string name="Validator_ShouldBeDigitOrAlphaOrPunctNotSpace">Invalid character [NR]: '[CH]' (should only be a digit or an alpha-numeric ASCII character or a punctuation with no space)</string>
<string name="Validator_ShouldBeDigitNotSpace">Invalid character [NR]: '[CH]' (should only be a digit with no space)</string>
<string name="Validator_ShouldBeASCII">Invalid character [NR]: '[CH]' (should only be an ASCII character)</string>
- <string name="Validator_ShouldBeNewLineOrASCII">Invalid character [NR]: '[CH]' (should only be an ASCII character or a new line)</string>
+ <string name="Validator_ShouldBeNewLineOrASCIINoPipe">Character [CH] at position [NR] should be printable ASCII (excluding pipe) or newline</string>
<!-- LSL Usage Hover Tips -->
<!-- NOTE: For now these are set as translate="false", until DEV-40761 is implemented (to internationalize the rest of tooltips in the same window).