1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-25 23:02:26 +00:00

check type of "size" before generate thumbnail

This commit is contained in:
lian
2015-07-28 19:59:42 +08:00
parent fa177dd150
commit fbd2980a7c
2 changed files with 18 additions and 0 deletions

View File

@@ -70,6 +70,12 @@ def generate_thumbnail(request, repo_id, size, path):
""" generate and save thumbnail if not exist
"""
try:
size = int(size)
except ValueError as e:
logger.error(e)
return False
thumbnail_dir = os.path.join(THUMBNAIL_ROOT, str(size))
if not os.path.exists(thumbnail_dir):
os.makedirs(thumbnail_dir)