Skip to content

Commit 99059c5

Browse files
committed
p#648 Fix recursive folder pasting
1 parent 9b7ab49 commit 99059c5

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

indra/newview/llinventorybridge.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4136,6 +4136,17 @@ void LLFolderBridge::perform_pasteFromClipboard()
41364136
}
41374137
else
41384138
{
4139+
// Check that no folder is being pasted into itself or into one of its descendants
4140+
for (const LLUUID& item_id : objects)
4141+
{
4142+
LLInventoryCategory* cat = model->getCategory(item_id);
4143+
if (cat && (item_id == mUUID || model->isObjectDescendentOf(mUUID, item_id)))
4144+
{
4145+
LLNotificationsUtil::add("CannotPasteFolderIntoSelf");
4146+
return;
4147+
}
4148+
}
4149+
41394150
// Check that all items can be moved into that folder : for the moment, only stock folder mismatch is checked
41404151
for (std::vector<LLUUID>::const_iterator iter = objects.begin(); iter != objects.end(); ++iter)
41414152
{

indra/newview/skins/default/xui/en/notifications.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,17 @@ Initialization with the Marketplace failed because of a system or network error.
424424
yestext="OK"/>
425425
</notification>
426426

427+
<notification
428+
icon="alertmodal.tga"
429+
name="CannotPasteFolderIntoSelf"
430+
type="alertmodal">
431+
You cannot paste a folder into itself or into one of its subfolders.
432+
<tag>fail</tag>
433+
<usetemplate
434+
name="okbutton"
435+
yestext="OK"/>
436+
</notification>
437+
427438
<notification
428439
icon="notifytip.tga"
429440
name="InvalidKeystroke"

0 commit comments

Comments
 (0)