FIRE-14896 - Don't allow renaming AO sets that contain non-ASCII characters - Fix creating name validation.

ziree 2014-11-08 03:46:32 +01:00
parent a46ce4268c
commit 7600a2de92
2 changed files with 12 additions and 6 deletions

View File

@ -342,9 +342,13 @@ void FloaterAO::onRenameSet()
std::string name=mSetSelector->getSimple();
LLStringUtil::trim(name);
LLUIString new_set_name=name;
if(!name.empty())
{
if(name.find_first_of(":|")==std::string::npos)
if(
LLTextValidate::validateASCIIPrintableNoPipe(new_set_name.getWString()) && // only allow ASCII
name.find_first_of(":|")==std::string::npos) // don't allow : or |
{
if(AOEngine::instance().renameSet(mSelectedSet,name))
{
@ -356,7 +360,7 @@ void FloaterAO::onRenameSet()
{
LLSD args;
args["AO_SET_NAME"]=name;
LLNotificationsUtil::add("RenameAOCantContainColon",args);
LLNotificationsUtil::add("RenameAOMustBeASCII",args);
}
}
mSetSelector->setSimple(mSelectedSet->getName());
@ -451,7 +455,9 @@ BOOL FloaterAO::newSetCallback(const LLSD& notification,const LLSD& response)
{
return FALSE;
}
else if(!LLTextValidate::validateASCIIPrintableNoPipe(new_set_name.getWString()))
else if(
!LLTextValidate::validateASCIIPrintableNoPipe(new_set_name.getWString()) || // only allow ASCII
newSetName.find_first_of(":|")!=std::string::npos) // don't allow : or |
{
LLSD args;
args["AO_SET_NAME"]=newSetName;

View File

@ -9218,10 +9218,10 @@ The name may only contain ASCII characters, excluding ":" and "|".
<notification
icon="alertmodal.tga"
name="RenameAOCantContainColon"
name="RenameAOMustBeASCII"
type="alertmodal">
Could not rename new AO set to "[AO_SET_NAME]".
The name may not contain ":" or "|" characters.
Could not rename AO set "[AO_SET_NAME]".
The name may only contain ASCII characters, excluding ":" and "|".
<usetemplate
name="okbutton"
yestext="OK"/>