From 3aa819c62c960eb5b06a4ff29d96496ed856b95c Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Tue, 1 Aug 2017 20:56:53 +0200 Subject: [PATCH] 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 --- apps/files/js/sidebarpreviewtext.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/files/js/sidebarpreviewtext.js b/apps/files/js/sidebarpreviewtext.js index a19a349701..3053cd6945 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' + } + }); } };