summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/private/URLGenerator.php13
-rw-r--r--lib/public/IURLGenerator.php8
2 files changed, 21 insertions, 0 deletions
diff --git a/lib/private/URLGenerator.php b/lib/private/URLGenerator.php
index 6f4f869238c..f4a83138e4c 100644
--- a/lib/private/URLGenerator.php
+++ b/lib/private/URLGenerator.php
@@ -91,6 +91,19 @@ class URLGenerator implements IURLGenerator {
return $this->getAbsoluteURL($this->linkToRoute($routeName, $arguments));
}
+ public function linkToOCSRouteAbsolute(string $routeName, array $arguments = []): string {
+ $route = \OC::$server->getRouter()->generate('ocs.'.$routeName, $arguments, false);
+
+ if (strpos($route, '/index.php') === 0) {
+ $route = substr($route, 10);
+ }
+
+ $route = substr($route, 7);
+ $route = '/ocs/v2.php' . $route;
+
+ return $this->getAbsoluteURL($route);
+ }
+
/**
* Creates an url
* @param string $app app
diff --git a/lib/public/IURLGenerator.php b/lib/public/IURLGenerator.php
index ebf35967551..368f65fe4c1 100644
--- a/lib/public/IURLGenerator.php
+++ b/lib/public/IURLGenerator.php
@@ -51,6 +51,14 @@ interface IURLGenerator {
public function linkToRouteAbsolute(string $routeName, array $arguments = array()): string;
/**
+ * @param string $routeName
+ * @param array $arguments
+ * @return string
+ * @since 15.0.0
+ */
+ public function linkToOCSRouteAbsolute(string $routeName, array $arguments = []): string;
+
+ /**
* Returns an URL for an image or file
* @param string $appName the name of the app
* @param string $file the name of the file