construct final url from parsed output
authorCaolán McNamara <caolanm@redhat.com>
Mon, 12 Aug 2019 19:32:54 +0000 (20:32 +0100)
committerBastien Roucariès <rouca@debian.org>
Sat, 12 Aug 2023 19:58:29 +0000 (20:58 +0100)
Change-Id: Ifd733625a439685ad307603eb2b00bf463eb9ca9
Reviewed-on: https://gerrit.libreoffice.org/77373
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
(cherry picked from commit 87959e5deea6d33cd35dbb3b8423056f9566710e)
Reviewed-on: https://gerrit.libreoffice.org/77379

Gbp-Pq: Name construct-final-url-from-parsed-output.diff

scripting/source/pyprov/pythonscript.py

index 64e1337d642eebfce859a88448d297a19ed89dec..0f74852523b34b50c872c4901025934f20d71522 100644 (file)
@@ -224,7 +224,13 @@ class MyUriHelper:
             sStorageUri = sStorageUri.replace( "|", "/" )
 
             # path to the .py file, relative to the base
-            sFileUri = sStorageUri[0:sStorageUri.find("$")]
+            funcNameStart = sStorageUri.find("$")
+            if funcNameStart != -1:
+                sFileUri = sStorageUri[0:funcNameStart]
+                sFuncName = sStorageUri[funcNameStart+1:]
+            else:
+                sFileUri = sStorageUri
+
             xFileUri = self.m_uriRefFac.parse(sFileUri)
             if not xFileUri:
                 message = "pythonscript: invalid relative uri '" + sFileUri+ "'"
@@ -241,7 +247,9 @@ class MyUriHelper:
                 log.debug( message )
                 raise RuntimeException( message )
 
-            ret = sBaseUri + sStorageUri
+            ret = sAbsScriptUri
+            if funcNameStart != -1:
+                ret = ret + "$" + sFuncName
             log.debug( "converting scriptURI="+scriptURI + " to storageURI=" + ret )
             return ret
         except UnoException as e: