summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2026-07-27 23:32:03 +0300
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2026-07-28 10:27:38 +0300
commit1d92b25c0334c7ba345b47bf576a45836c6ef198 (patch)
treea69ffcf6e645a5d014f44be8a29ee4877c2aa107
parent1c81813e79c4acc917d75b47117778dd277e5b1f (diff)
#6057 Fix script's 'save as' logic not sanitizing file names
-rw-r--r--indra/newview/llpreviewtexture.cpp3
-rw-r--r--indra/newview/llviewermenufile.cpp4
2 files changed, 5 insertions, 2 deletions
diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp
index 800fc7ec0c..e886957049 100644
--- a/indra/newview/llpreviewtexture.cpp
+++ b/indra/newview/llpreviewtexture.cpp
@@ -300,7 +300,8 @@ void LLPreviewTexture::saveAs()
if( mLoadingFullImage )
return;
- std::string filename = getItem() ? LLDir::getScrubbedFileName(getItem()->getName()) : LLStringUtil::null;
+ // startPicker will sanitize the name
+ std::string filename = getItem() ? getItem()->getName() : LLStringUtil::null;
LLFilePickerReplyThread::startPicker(boost::bind(&LLPreviewTexture::saveTextureToFile, this, _1), LLFilePicker::FFSAVE_TGAPNG, filename);
}
diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp
index 772abb0373..79d7d41836 100644
--- a/indra/newview/llviewermenufile.cpp
+++ b/indra/newview/llviewermenufile.cpp
@@ -335,7 +335,9 @@ void LLFilePickerReplyThread::startPicker(const file_picked_signal_t::slot_type
void LLFilePickerReplyThread::startPicker(const file_picked_signal_t::slot_type & cb, LLFilePicker::ESaveFilter filter, const std::string & proposed_name, const file_picked_signal_t::slot_type & failure_cb)
{
- (new LLFilePickerReplyThread(cb, filter, proposed_name, failure_cb))->getFile();
+ // Remove invalid characters
+ std::string sanitized_name = LLDir::getScrubbedFileName(proposed_name);
+ (new LLFilePickerReplyThread(cb, filter, sanitized_name, failure_cb))->getFile();
}
void LLFilePickerReplyThread::notify(const std::vector<std::string>& filenames)