summaryrefslogtreecommitdiffstats
path: root/lib/private/helper.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/helper.php')
-rw-r--r--lib/private/helper.php21
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/private/helper.php b/lib/private/helper.php
index 5cd1fbacce7..4058ec199a7 100644
--- a/lib/private/helper.php
+++ b/lib/private/helper.php
@@ -36,7 +36,7 @@ class OC_Helper {
* @param array $parameters
* @return
* @internal param array $args with param=>value, will be appended to the returned url
- * @returns the url
+ * @returns string the url
*
* Returns a url to the given app and file.
*/
@@ -457,6 +457,16 @@ class OC_Helper {
}
/**
+ * Get a secure mimetype that won't expose potential XSS.
+ *
+ * @param string $mimeType
+ * @return string
+ */
+ static function getSecureMimeType($mimeType) {
+ return self::getMimetypeDetector()->getSecureMimeType($mimeType);
+ }
+
+ /**
* get the mimetype form a data string
*
* @param string $data
@@ -901,12 +911,15 @@ class OC_Helper {
* Calculate the disc space for the given path
*
* @param string $path
+ * @param \OCP\Files\FileInfo $rootInfo (optional)
* @return array
*/
- public static function getStorageInfo($path) {
+ public static function getStorageInfo($path, $rootInfo = null) {
// return storage info without adding mount points
- $rootInfo = \OC\Files\Filesystem::getFileInfo($path, false);
- $used = $rootInfo['size'];
+ if (is_null($rootInfo)) {
+ $rootInfo = \OC\Files\Filesystem::getFileInfo($path, false);
+ }
+ $used = $rootInfo->getSize();
if ($used < 0) {
$used = 0;
}