summaryrefslogtreecommitdiffstats
path: root/lib/private/api.php
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2015-10-12 23:39:16 +0200
committerLukas Reschke <lukas@owncloud.com>2015-10-12 23:39:16 +0200
commite03f0542e483c6d678414b0f3338110d0d506e8f (patch)
tree07d534b5e759e6ec0f9678964a19b2c2a109598e /lib/private/api.php
parent64a8d016946560182f107e48b9fcc81e517b6945 (diff)
downloadnextcloud-server-e03f0542e483c6d678414b0f3338110d0d506e8f.tar.gz
nextcloud-server-e03f0542e483c6d678414b0f3338110d0d506e8f.zip
Strip directory from scriptName
`\OCP\IRequest::getScriptName` will also return the directory, so if ownCloud is installed in a subfolder such as `owncloud/` it will resolve to `/owncloud/ocs/v2.php`. This made this check fail and also made it return invalid status codes.
Diffstat (limited to 'lib/private/api.php')
-rw-r--r--lib/private/api.php10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/private/api.php b/lib/private/api.php
index cd5148c51a1..10d58f2d9e6 100644
--- a/lib/private/api.php
+++ b/lib/private/api.php
@@ -386,7 +386,7 @@ class OC_API {
$meta = $result->getMeta();
$data = $result->getData();
- if (self::isV2()) {
+ if (self::isV2(\OC::$server->getRequest())) {
$statusCode = self::mapStatusCodes($result->getStatusCode());
if (!is_null($statusCode)) {
$meta['statuscode'] = $statusCode;
@@ -449,13 +449,13 @@ class OC_API {
}
/**
- * @return boolean
+ * @param \OCP\IRequest $request
+ * @return bool
*/
- private static function isV2() {
- $request = \OC::$server->getRequest();
+ protected static function isV2(\OCP\IRequest $request) {
$script = $request->getScriptName();
- return $script === '/ocs/v2.php';
+ return substr($script, -11) === '/ocs/v2.php';
}
/**