FIRE-29774: Make LSL script recovery only show backups for the actual account

master
Ansariel 2020-07-30 13:54:51 +02:00
parent d3248bcff8
commit 38bac72123
4 changed files with 27 additions and 1 deletions

View File

@ -25,6 +25,7 @@
#include "llinventorymodel.h"
#include "llinventorypanel.h"
#include "llscrolllistctrl.h"
#include "lltrans.h"
#include "llviewerassettype.h"
#include "llviewerinventory.h"
#include "llviewerregion.h"
@ -159,13 +160,30 @@ void LLScriptRecoverQueue::recoverIfNeeded()
{
// Build a friendly name for the file
std::string strName = gDirUtilp->getBaseFileName(strFilename, true);
std::string agent_id_str = gAgentID.asString();
LLStringUtil::replaceString(agent_id_str, "-", "");
std::string::size_type agent_delim_offset = strName.find_first_of("_");
if (agent_delim_offset != std::string::npos && agent_delim_offset != 0)
{
std::string file_agent_id_str = strName.substr(0, agent_delim_offset);
if (file_agent_id_str != agent_id_str)
{
continue;
}
else
{
strName.erase(0, agent_delim_offset + 1);
}
}
std::string::size_type offset = strName.find_last_of("-");
if ( (std::string::npos != offset) && (offset != 0) && (offset == strName.length() - 9))
strName.erase(strName.length() - 9);
LLStringUtil::trim(strName);
if (0 == strName.length())
strName = "(Unknown script)";
strName = LLTrans::getString("unknown_script");
sdFiles.append(LLSD().with("path", strTempPath + strFilename).with("name", strName));
}

View File

@ -2022,6 +2022,10 @@ std::string LLScriptEdContainer::getBackupFileName() const
// NOTE: this function is not guaranteed to return the same filename every time (i.e. the item name may have changed)
std::string strFile = LLFile::tmpdir();
std::string agent_id_str = gAgentID.asString();
LLStringUtil::replaceString(agent_id_str, "-", "");
strFile += agent_id_str + "_";
// Find the inventory item for this script
const LLInventoryItem* pItem = getItem();
if (pItem)

View File

@ -7096,4 +7096,7 @@ Ihre aktuelle Position: [AVATAR_POS]
<string name="TexturePickerOutfitHeader">
Foto für Outfit
</string>
<string name="unknown_script">
(Unbekanntes Skript)
</string>
</strings>

View File

@ -3191,4 +3191,5 @@ Your current position: [AVATAR_POS]
<string name="No">No</string>
<string name="FSUrlEntryWearLabel">Wear inventory folder</string>
<string name="TexturePickerOutfitHeader">Picture for Outfit</string>
<string name="unknown_script">(Unknown script)</floater.string>
</strings>