Skip to content

Commit

Permalink
Do not fetch the whole text file for the sidebar preview
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
rullzer committed Aug 1, 2017
1 parent 84c22fd commit c91f8a0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion apps/files/js/sidebarpreviewtext.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
});
}
};

Expand Down

0 comments on commit c91f8a0

Please sign in to comment.