aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/api.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/api.php')
-rw-r--r--lib/private/api.php40
1 files changed, 35 insertions, 5 deletions
diff --git a/lib/private/api.php b/lib/private/api.php
index fde2020bcfa..6d7354c7193 100644
--- a/lib/private/api.php
+++ b/lib/private/api.php
@@ -1,4 +1,34 @@
<?php
+/**
+ * @author Bart Visscher <bartv@thisnet.nl>
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @author Björn Schießle <schiessle@owncloud.com>
+ * @author Joas Schilling <nickvergessen@owncloud.com>
+ * @author Jörn Friedrich Dreyer <jfd@butonic.de>
+ * @author Lukas Reschke <lukas@owncloud.com>
+ * @author Michael Gapczynski <GapczynskiM@gmail.com>
+ * @author Morris Jobke <hey@morrisjobke.de>
+ * @author Robin Appelman <icewind@owncloud.com>
+ * @author Thomas Müller <thomas.mueller@tmit.eu>
+ * @author Tom Needham <tom@owncloud.com>
+ * @author Vincent Petry <pvince81@owncloud.com>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
use OCP\API;
use OCP\AppFramework\Http;
@@ -360,7 +390,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;
@@ -423,13 +453,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';
}
/**