From a4431fe12f84d1c2a90d82603d670a0a4bb756e3 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Fri, 14 Jan 2022 15:36:00 +0200 Subject: SL-16638 don't allow downloading files from the built-in browser --- indra/newview/llmediactrl.cpp | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'indra/newview/llmediactrl.cpp') diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 0affe8efb4..5393d0b0b7 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -46,6 +46,7 @@ #include "lluictrlfactory.h" // LLDefaultChildRegistry #include "llkeyboard.h" #include "llviewermenu.h" +#include "llviewermenufile.h" // LLFilePickerThread // linden library includes #include "llfocusmgr.h" @@ -105,7 +106,8 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) : mTrusted(p.trusted_content), mWindowShade(NULL), mHoverTextChanged(false), - mContextMenu(NULL) + mContextMenu(NULL), + mAllowFileDownload(false) { { LLColor4 color = p.caret_color().get(); @@ -1129,8 +1131,23 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) case MEDIA_EVENT_FILE_DOWNLOAD: { - //llinfos << "Media event - file download requested - filename is " << self->getFileDownloadFilename() << llendl; - //LLNotificationsUtil::add("MediaFileDownloadUnsupported"); + if (mAllowFileDownload) + { + // pick a file from SAVE FILE dialog + // for now the only thing that should be allowed to save is 360s + std::string suggested_filename = self->getFileDownloadFilename(); + LLFilePicker::ESaveFilter filter = LLFilePicker::FFSAVE_ALL; + if (suggested_filename.find(".jpg") != std::string::npos || suggested_filename.find(".jpeg") != std::string::npos) + filter = LLFilePicker::FFSAVE_JPEG; + if (suggested_filename.find(".png") != std::string::npos) + filter = LLFilePicker::FFSAVE_PNG; + + (new LLMediaFilePicker(self, filter, suggested_filename))->getFile(); + } + else + { + LLNotificationsUtil::add("MediaFileDownloadUnsupported"); + } }; break; -- cgit v1.2.3 From 8116078c7273bc0f52424ede96563a4418155508 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 2 Mar 2022 23:41:13 +0200 Subject: SL-16965 360 Snapshot tool fails to save file to computer --- indra/newview/llmediactrl.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/llmediactrl.cpp') diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 5393d0b0b7..9142aadab9 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -1146,6 +1146,11 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) } else { + // Media might be blocked, waiting for a file, + // send an empty response to unblock it + const std::vector empty_response; + self->sendPickFileResponse(empty_response); + LLNotificationsUtil::add("MediaFileDownloadUnsupported"); } }; -- cgit v1.2.3