Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-06-29 16:20:47 +0300
committerMorris Jobke <hey@morrisjobke.de>2015-07-07 14:56:49 +0300
commite557fe0aabe9e1e97249aa5446eef30c804da79f (patch)
tree037e1d9ec9f10f3b901892d08f8beec2c9b6bd6b /apps/files/ajax
parent5a528214b8c6326590c8ff6784187c4191d64f56 (diff)
Add proper download started feedback
* this code adds a cookie when a special get parameter is set * the content of this get parameter is used as value for the cookie * the cookie expires after 20 seconds * the JS code checks every 500 milliseconds for the cookie -> if the cookie is set the request returned and the download is started
Diffstat (limited to 'apps/files/ajax')
-rw-r--r--apps/files/ajax/download.php11
1 files changed, 11 insertions, 0 deletions
diff --git a/apps/files/ajax/download.php b/apps/files/ajax/download.php
index e67635ab853..26bab8837b4 100644
--- a/apps/files/ajax/download.php
+++ b/apps/files/ajax/download.php
@@ -39,4 +39,15 @@ if (!is_array($files_list)) {
$files_list = array($files);
}
+/**
+ * this sets a cookie to be able to recognize the start of the download
+ * the content must not be longer than 32 characters and must only contain
+ * alphanumeric characters
+ */
+if(isset($_GET['downloadStartSecret'])
+ && !isset($_GET['downloadStartSecret'][32])
+ && preg_match('!^[a-zA-Z0-9]+$!', $_GET['downloadStartSecret']) === 1) {
+ setcookie('ocDownloadStarted', $_GET['downloadStartSecret'], time() + 20, '/');
+}
+
OC_Files::get($dir, $files_list, $_SERVER['REQUEST_METHOD'] == 'HEAD');