scripting/source/pyprov/pythonscript.py |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

New commits:
commit 65276d9a6ddb191ea9ea0ca6a7ddff37f1e03826
Author:     Mike Kaganski <[email protected]>
AuthorDate: Sun Nov 16 16:02:21 2025 +0100
Commit:     Mike Kaganski <[email protected]>
CommitDate: Mon Nov 17 04:32:34 2025 +0100

    Use XVndSunStarExpandUrl::expand directly, instead of re-implementing it
    
    Similar to commit efd69fbd84d823efbd22a2998327f0efd4e140a9 (Use
    XVndSunStarExpandUrl::expand directly, instead of re-implementing it,
    2025-11-16).
    
    Change-Id: I4857b9172308a660d5a0d20b414d991f394864af
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194072
    Reviewed-by: Mike Kaganski <[email protected]>
    Tested-by: Jenkins

diff --git a/scripting/source/pyprov/pythonscript.py 
b/scripting/source/pyprov/pythonscript.py
index d2a57760833b..74dd6e29b536 100644
--- a/scripting/source/pyprov/pythonscript.py
+++ b/scripting/source/pyprov/pythonscript.py
@@ -26,7 +26,6 @@ import time
 import ast
 import platform
 from com.sun.star.uri.RelativeUriExcessParentSegments import RETAIN
-from urllib.parse import unquote
 
 from com.sun.star.uno import RuntimeException
 from com.sun.star.lang import IllegalArgumentException
@@ -976,12 +975,10 @@ class PythonScript(unohelper.Base, XScript):
 
 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(unquote(uri))
-        )
+        ctx = uno.getComponentContext()
+        fac = 
ctx.ServiceManager.createInstanceWithContext("com.sun.star.uri.UriReferenceFactory",
 ctx)
+        ref = fac.parse(uri)
+        uri = 
ref.expand(ctx.getValueByName("/singletons/com.sun.star.util.theMacroExpander"))
     if uri.startswith("file:"):
         uri = uno.absolutize("", uri)  # necessary to get rid of .. in uri
     return uri

Reply via email to