From 12896c9ed652a239cb1fd05bbd9a32f040e3381f Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sun, 12 Feb 2023 23:13:20 +0300 Subject: tdf#153571: properly unquote (URL-decode) vnd.sun.star.expand payload Similar to what is done in bootstrap_expandUri, expandUnoRcUrl, UrlReference::expand, JavaLoader.expand_url, and is documented in XVndSunStarExpandUrl interface. Change-Id: I65349b52734f212e6a04e615d39fa2563f62d472 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146840 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- scripting/source/pyprov/pythonscript.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'scripting') diff --git a/scripting/source/pyprov/pythonscript.py b/scripting/source/pyprov/pythonscript.py index 4955c8c54888..00d96d9b0d3f 100644 --- a/scripting/source/pyprov/pythonscript.py +++ b/scripting/source/pyprov/pythonscript.py @@ -26,6 +26,7 @@ import time import ast import platform from com.sun.star.uri.RelativeUriExcessParentSegments import RETAIN +from urllib.parse import unquote class LogLevel: NONE = 0 # production level @@ -854,7 +855,7 @@ def getPackageName2PathMap( sfa, storageType ): paths = getPathsFromPackage( j, sfa ) if len( paths ) > 0: # map package name to url, we need this later - log.isErrorLevel() and log.error( "adding Package " + transientPathElement + " " + str( paths ) ) + log.debug( "adding Package " + transientPathElement + " " + str( paths ) ) ret[ lastElement( j ) ] = Package( paths, transientPathElement ) return ret @@ -941,7 +942,7 @@ def expandUri( uri ): if uri.startswith( "vnd.sun.star.expand:" ): uri = uri.replace( "vnd.sun.star.expand:", "",1) uri = uno.getComponentContext().getByName( - "/singletons/com.sun.star.util.theMacroExpander" ).expandMacros( uri ) + "/singletons/com.sun.star.util.theMacroExpander" ).expandMacros( unquote(uri) ) if uri.startswith( "file:" ): uri = uno.absolutize("",uri) # necessary to get rid of .. in uri return uri -- cgit