sfx2/source/appl/openuriexternally.cxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit db0f2c29bf3a6ad5a08f8524ea0e65aa90792bb2
Author:     Gabor Kelemen <kelem...@ubuntu.com>
AuthorDate: Fri Nov 12 20:01:43 2021 +0100
Commit:     Gabor Kelemen <kelem...@ubuntu.com>
CommitDate: Tue Nov 23 13:57:41 2021 +0100

    tdf#144769 Properly encode file name in error dialog
    
    Change-Id: Ie8f0b57c33fff787735b09ecf8308f86b56d8bb4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125121
    Tested-by: Jenkins
    Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org>
    Reviewed-by: Gabor Kelemen <kelem...@ubuntu.com>

diff --git a/sfx2/source/appl/openuriexternally.cxx 
b/sfx2/source/appl/openuriexternally.cxx
index ebc5886ea5b8..7cc923aba241 100644
--- a/sfx2/source/appl/openuriexternally.cxx
+++ b/sfx2/source/appl/openuriexternally.cxx
@@ -18,6 +18,7 @@
 #include <comphelper/processfactory.hxx>
 #include <rtl/ustring.hxx>
 #include <sfx2/sfxresid.hxx>
+#include <tools/urlobj.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/weld.hxx>
 #include <openuriexternally.hxx>
@@ -95,7 +96,7 @@ IMPL_LINK_NOARG(URITools, onOpenURI, Timer*, void)
                     Application::CreateMessageDialog(
                         mpDialogParent, VclMessageType::Warning, 
VclButtonsType::OkCancel,
                         SfxResId(STR_DANGEROUS_TO_OPEN)));
-                
eb->set_primary_text(eb->get_primary_text().replaceFirst("$(ARG1)", msURI));
+                
eb->set_primary_text(eb->get_primary_text().replaceFirst("$(ARG1)", 
INetURLObject::decode(msURI, INetURLObject::DecodeMechanism::Unambiguous)));
                 if (eb->run() == RET_OK) {
                     flags = 0;
                     continue;
@@ -104,7 +105,7 @@ IMPL_LINK_NOARG(URITools, onOpenURI, Timer*, void)
                 std::unique_ptr<weld::MessageDialog> 
eb(Application::CreateMessageDialog(mpDialogParent,
                                                                          
VclMessageType::Warning, VclButtonsType::Ok,
                                                                          
SfxResId(STR_NO_ABS_URI_REF)));
-                
eb->set_primary_text(eb->get_primary_text().replaceFirst("$(ARG1)", msURI));
+                
eb->set_primary_text(eb->get_primary_text().replaceFirst("$(ARG1)", 
INetURLObject::decode(msURI, INetURLObject::DecodeMechanism::Unambiguous)));
                 eb->run();
             }
         } catch (css::system::SystemShellExecuteException & e) {

Reply via email to