Pass the real file size on bigfile request as the size on the disk can be smaller

This commit is contained in:
shortcutme 2018-07-16 01:34:48 +02:00
parent 1296ab9b60
commit dae1197ce4
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -113,7 +113,9 @@ class UiRequestPlugin(object):
if kwargs.get("file_size", 0) > 1024 * 1024 and kwargs.get("path_parts"): # Only check files larger than 1MB if kwargs.get("file_size", 0) > 1024 * 1024 and kwargs.get("path_parts"): # Only check files larger than 1MB
path_parts = kwargs["path_parts"] path_parts = kwargs["path_parts"]
site = self.server.site_manager.get(path_parts["address"]) site = self.server.site_manager.get(path_parts["address"])
kwargs["file_obj"] = site.storage.openBigfile(path_parts["inner_path"], prebuffer=2 * 1024 * 1024) big_file = site.storage.openBigfile(path_parts["inner_path"], prebuffer=2 * 1024 * 1024)
kwargs["file_obj"] = big_file
kwargs["file_size"] = big_file.size
return super(UiRequestPlugin, self).actionFile(file_path, *args, **kwargs) return super(UiRequestPlugin, self).actionFile(file_path, *args, **kwargs)