This fix addresses the issue where articles with an empty string as their download_size cause a ValueError by trying to convert an empty string to an integer. The modification ensures the conversion and formatting only occur when article.download_size is neither None nor an empty string.
Files Affected
frontpage/routes.py
Modifications
# In frontpage/routes.py, within the article view function:
- format_size(int(article.download_size)) if article.download_size is not None else None
+ format_size(int(article.download_size)) if article.download_size not in [None, ''] else None
Closes #33
Proposed Changes
This fix addresses the issue where articles with an empty string as their
download_size
cause aValueError
by trying to convert an empty string to an integer. The modification ensures the conversion and formatting only occur whenarticle.download_size
is neitherNone
nor an empty string.Files Affected
frontpage/routes.py
Modifications