do not display files bigger than 1mo

This commit is contained in:
tdurieux
2017-09-29 11:51:00 +02:00
parent fec96a326e
commit 1a9fb3d142

View File

@@ -48,6 +48,8 @@ class Anonymous_Github:
for term in terms:
content = content.replace(term, "XXX")
return content
if file.size > 1000000:
return Markup("The file %s is too big please download it: <a href='%s'>Download %s</a>" % (file.name, file.url, file.name))
if ".md" in file.name:
return Markup("<div class='markdown-body'>%s</div>" % removeTerms(self.github.render_markdown(file.decoded_content), terms))
if ".jpg" in file.name or ".png" in file.name or ".png" in file.name or ".gif" in file.name: