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.php17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/private/helper.php b/lib/private/helper.php
index 580f81acc62..e5d1fa9b513 100644
--- a/lib/private/helper.php
+++ b/lib/private/helper.php
@@ -151,6 +151,7 @@ class OC_Helper {
*/
public static function mimetypeIcon($mimetype) {
$alias = array(
+ 'application/octet-stream' => 'file', // use file icon as fallback
'application/xml' => 'code/xml',
'application/msword' => 'x-office/document',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'x-office/document',
@@ -804,18 +805,22 @@ class OC_Helper {
/**
* @brief calculates the maximum upload size respecting system settings, free space and user quota
*
- * @param $dir the current folder where the user currently operates
- * @return number of bytes representing
+ * @param string $dir the current folder where the user currently operates
+ * @param int $freeSpace the number of bytes free on the storage holding $dir, if not set this will be received from the storage directly
+ * @return int number of bytes representing
*/
- public static function maxUploadFilesize($dir) {
- return min(self::freeSpace($dir), self::uploadLimit());
+ public static function maxUploadFilesize($dir, $freeSpace = null) {
+ if (is_null($freeSpace)){
+ $freeSpace = self::freeSpace($dir);
+ }
+ return min($freeSpace, self::uploadLimit());
}
/**
* Calculate free space left within user quota
*
- * @param $dir the current folder where the user currently operates
- * @return number of bytes representing
+ * @param string $dir the current folder where the user currently operates
+ * @return int number of bytes representing
*/
public static function freeSpace($dir) {
$freeSpace = \OC\Files\Filesystem::free_space($dir);