2ceb93
From f107a8c90168124462ddd00db015810081d4be2f Mon Sep 17 00:00:00 2001
2ceb93
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
2ceb93
Date: Mon, 12 Aug 2019 20:32:54 +0100
2ceb93
Subject: [PATCH 1/2] construct final url from parsed output
2ceb93
MIME-Version: 1.0
2ceb93
Content-Type: text/plain; charset=UTF-8
2ceb93
Content-Transfer-Encoding: 8bit
2ceb93
2ceb93
Change-Id: Ifd733625a439685ad307603eb2b00bf463eb9ca9
2ceb93
Reviewed-on: https://gerrit.libreoffice.org/77373
2ceb93
Tested-by: Jenkins
2ceb93
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2ceb93
(cherry picked from commit 87959e5deea6d33cd35dbb3b8423056f9566710e)
2ceb93
Reviewed-on: https://gerrit.libreoffice.org/77377
2ceb93
(cherry picked from commit c03acb9b8a97254cfcf7c45ef920b93b7f1dd344)
2ceb93
2ceb93
an absolute uri is invalid input
2ceb93
2ceb93
Change-Id: I392be4282be8ed67e3451b28d2c9f22acd4c87fc
2ceb93
Reviewed-on: https://gerrit.libreoffice.org/77564
2ceb93
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2ceb93
Tested-by: Stephan Bergmann <sbergman@redhat.com>
2ceb93
(cherry picked from commit 3c076e54f736980e208f5c27ecf179aa90aea103)
2ceb93
Reviewed-on: https://gerrit.libreoffice.org/77572
2ceb93
Tested-by: Jenkins
2ceb93
(cherry picked from commit 5445f7ffd09e891b220dabb19cd013bcf591fc08)
2ceb93
2ceb93
Improve check for absolute URI
2ceb93
2ceb93
Change-Id: I4dee44832107f72f8f3fb68554428dc1e646c346
2ceb93
Reviewed-on: https://gerrit.libreoffice.org/77706
2ceb93
Tested-by: Jenkins
2ceb93
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2ceb93
(cherry picked from commit c79efeb66f7951305d0334bc288aee1c571a8728)
2ceb93
Reviewed-on: https://gerrit.libreoffice.org/77724
2ceb93
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2ceb93
Tested-by: Caolán McNamara <caolanm@redhat.com>
2ceb93
(cherry picked from commit 52f7aa318722bd17c77ee5c4fa8307936e7b53af)
2ceb93
---
2ceb93
 scripting/source/pyprov/pythonscript.py | 17 +++++++++++++++--
2ceb93
 1 file changed, 15 insertions(+), 2 deletions(-)
2ceb93
2ceb93
diff --git a/scripting/source/pyprov/pythonscript.py b/scripting/source/pyprov/pythonscript.py
2ceb93
index 64e1337d642e..acb6184bf437 100644
2ceb93
--- a/scripting/source/pyprov/pythonscript.py
2ceb93
+++ b/scripting/source/pyprov/pythonscript.py
2ceb93
@@ -224,13 +224,24 @@ class MyUriHelper:
2ceb93
             sStorageUri = sStorageUri.replace( "|", "/" )
2ceb93
 
2ceb93
             # path to the .py file, relative to the base
2ceb93
-            sFileUri = sStorageUri[0:sStorageUri.find("$")]
2ceb93
+            funcNameStart = sStorageUri.find("$")
2ceb93
+            if funcNameStart != -1:
2ceb93
+                sFileUri = sStorageUri[0:funcNameStart]
2ceb93
+                sFuncName = sStorageUri[funcNameStart+1:]
2ceb93
+            else:
2ceb93
+                sFileUri = sStorageUri
2ceb93
+
2ceb93
             xFileUri = self.m_uriRefFac.parse(sFileUri)
2ceb93
             if not xFileUri:
2ceb93
                 message = "pythonscript: invalid relative uri '" + sFileUri+ "'"
2ceb93
                 log.debug( message )
2ceb93
                 raise RuntimeException( message )
2ceb93
 
2ceb93
+            if not xFileUri.hasRelativePath():
2ceb93
+                message = "pythonscript: an absolute uri is invalid '" + sFileUri+ "'"
2ceb93
+                log.debug( message )
2ceb93
+                raise RuntimeException( message )
2ceb93
+
2ceb93
             # absolute path to the .py file
2ceb93
             xAbsScriptUri = self.m_uriRefFac.makeAbsolute(xBaseUri, xFileUri, True, RETAIN)
2ceb93
             sAbsScriptUri = xAbsScriptUri.getUriReference()
2ceb93
@@ -241,7 +252,9 @@ class MyUriHelper:
2ceb93
                 log.debug( message )
2ceb93
                 raise RuntimeException( message )
2ceb93
 
2ceb93
-            ret = sBaseUri + sStorageUri
2ceb93
+            ret = sAbsScriptUri
2ceb93
+            if funcNameStart != -1:
2ceb93
+                ret = ret + "$" + sFuncName
2ceb93
             log.debug( "converting scriptURI="+scriptURI + " to storageURI=" + ret )
2ceb93
             return ret
2ceb93
         except UnoException as e:
2ceb93
-- 
2ceb93
2.21.0
2ceb93