summaryrefslogtreecommitdiff
path: root/wizards/com/sun/star
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-02-13 11:22:03 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2023-02-13 11:29:34 +0000
commit00f6c36b603416b73e1327ac4c862b1eaca2d277 (patch)
treee9004fd7ae4ea91a9d8908fe86ea0e0d97801bef /wizards/com/sun/star
parentb926ba60d11cb78b4e042e2abb2d00dde128a1f8 (diff)
Fix/simplify some vnd.sun.star.expand: handling
The vnd.sun.star.expand: payload must be URL-decoded prior to passing it to expandMacros; the protocol must be checked case-insensitively. Use startsWithIgnoreAsciiCase for that. Change-Id: I2be993a0400a27cb7dc57207cd0824b4505afd2b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146855 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'wizards/com/sun/star')
-rw-r--r--wizards/com/sun/star/wizards/common/FileAccess.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/wizards/com/sun/star/wizards/common/FileAccess.java b/wizards/com/sun/star/wizards/common/FileAccess.java
index 1dfb3c90d6b5..4e8d520a529f 100644
--- a/wizards/com/sun/star/wizards/common/FileAccess.java
+++ b/wizards/com/sun/star/wizards/common/FileAccess.java
@@ -21,6 +21,7 @@ import com.sun.star.beans.XPropertySet;
import com.sun.star.lang.Locale;
import com.sun.star.uno.Exception;
import com.sun.star.util.XMacroExpander;
+import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Vector;
@@ -29,6 +30,7 @@ import com.sun.star.io.XActiveDataSink;
import com.sun.star.io.XInputStream;
import com.sun.star.io.XTextInputStream;
import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lib.util.StringHelper;
import com.sun.star.ucb.CommandAbortedException;
import com.sun.star.ucb.XFileIdentifierConverter;
import com.sun.star.ucb.XSimpleFileAccess;
@@ -184,9 +186,11 @@ public class FileAccess
for (int i = 0; i < Template_internal.length; i++)
{
String sPath = Template_internal[i];
- if (sPath.startsWith("vnd."))
+ if (sPath.toLowerCase().startsWith("vnd.sun.star.expand:"))
{
- String sPathToExpand = sPath.substring("vnd.sun.star.Expand:".length());
+ String sPathToExpand = URLDecoder.decode(StringHelper.replace(
+ sPath.substring("vnd.sun.star.expand:".length()),
+ '+', "%2B"), "UTF-8");
XMacroExpander xExpander = Helper.getMacroExpander(xMSF);
sPath = xExpander.expandMacros(sPathToExpand);
@@ -201,7 +205,7 @@ public class FileAccess
aPathList.add(Template_writable);
// There was a bug here, because we have to search through the whole list of paths
}
- catch (Exception exception)
+ catch (java.lang.Exception exception)
{
exception.printStackTrace(System.err);
}