Skip to content
This repository has been archived by the owner on Apr 21, 2019. It is now read-only.

Commit

Permalink
Fix a potential bug where the image filename is to loarge for the db.
Browse files Browse the repository at this point in the history
* If the filename is greater than 132 characters let's not save it since it will cause
  a database error.  Using 132 characters as the cut-off value since we need to take
  into account the 'upload_to' values of the Character & Publisher models.
  • Loading branch information
bpepple committed Aug 1, 2018
1 parent 02e5166 commit 034725d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion comics/utils/comicimporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,11 @@ def getDetailInfo(self, db_obj, fields, api_url):
db_obj.year = data['year']
db_obj.cvurl = data['cvurl']
db_obj.desc = data['desc']
db_obj.image = data['image']
# If the image name from Comic Vine is too large, don't save it since it will
# cause a DB error. Using 132 as the value since that will take into account the
# upload_to value from the longest models (Characters & Pubishers).
if (len(data['image']) < 132):
db_obj.image = data['image']
db_obj.save()

return True
Expand Down

0 comments on commit 034725d

Please sign in to comment.