diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2017-08-01 20:56:53 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2017-08-03 20:32:59 +0200 |
commit | 3aa819c62c960eb5b06a4ff29d96496ed856b95c (patch) | |
tree | dad6bc051886967cde523191cc5170059159f079 /apps/files | |
parent | bb865a55febe7b712a0e6cc7e1e93034f60a0e8b (diff) | |
download | nextcloud-server-3aa819c62c960eb5b06a4ff29d96496ed856b95c.tar.gz nextcloud-server-3aa819c62c960eb5b06a4ff29d96496ed856b95c.zip |
Do not fetch the whole text file for the sidebar preview
Just fetch the first 10kb. This should be more than enough in 99% of the
cases. And avoid downloading a 10mb text file just to display a tiny
portion.
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/files')
-rw-r--r-- | apps/files/js/sidebarpreviewtext.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/apps/files/js/sidebarpreviewtext.js b/apps/files/js/sidebarpreviewtext.js index a19a349701b..3053cd6945d 100644 --- a/apps/files/js/sidebarpreviewtext.js +++ b/apps/files/js/sidebarpreviewtext.js @@ -35,7 +35,12 @@ }, getFileContent: function (path) { - return $.get(OC.linkToRemoteBase('files' + path)); + return $.ajax({ + url: OC.linkToRemoteBase('files' + path), + headers: { + 'Range': 'bytes=0-10240' + } + }); } }; |