Previously, the storage statistics were always for the root dir.
This means that the upload button would always show the limit for the
root dir, even when uploading to a shared dir or external storage.
This fix adds a "dir" argument to getstoragestats.php.
Partial backport of
31181e4348b9af2625cf4d6ad38cf4cd81db3c1f
// only need filesystem apps
$RUNTIME_APPTYPES = array('filesystem');
+$dir = '/';
+
+if (isset($_GET['dir'])) {
+ $dir = $_GET['dir'];
+}
+
OCP\JSON::checkLoggedIn();
// send back json
-OCP\JSON::success(array('data' => \OCA\files\lib\Helper::buildFileStorageStatistics('/')));
+OCP\JSON::success(array('data' => \OCA\files\lib\Helper::buildFileStorageStatistics($dir)));
// file space size sync
function update_storage_statistics() {
- $.getJSON(OC.filePath('files','ajax','getstoragestats.php'),function(response) {
+ var currentDir = $('#dir').val() || '/';
+ $.getJSON(OC.filePath('files','ajax','getstoragestats.php?dir=' + encodeURIComponent(currentDir)),function(response) {
Files.updateMaxUploadFilesize(response);
});
}