Fix serving binary files with zero characters in it.

This commit is contained in:
shortcutme 2019-06-04 16:18:52 +02:00
parent bb7af2e8ed
commit 350ee13d66
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -620,6 +620,7 @@ class FileRequestPlugin(object):
if file.read(10) == b"\0" * 10:
# Looks empty, but makes sures we don't have that piece
file_info = site.content_manager.getFileInfo(inner_path)
if "piece_size" in file_info:
piece_i = int(pos / file_info["piece_size"])
if not site.storage.piecefields[file_info["sha512"]][piece_i]:
return False