Skip to content

Commit

Permalink
Fix thumbnail_img NoneType error (#2941)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?

fix thumbnail_img NoneType error

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
  • Loading branch information
wingjson authored Oct 22, 2024
1 parent 1a623df commit 6a4858a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions api/utils/file_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,11 @@ def thumbnail_img(filename, blob):

def thumbnail(filename, blob):
img = thumbnail_img(filename, blob)
return IMG_BASE64_PREFIX + \
base64.b64encode(img).decode("utf-8")
if img is not None:
return IMG_BASE64_PREFIX + \
base64.b64encode(img).decode("utf-8")
else:
return ''

def traversal_files(base):
for root, ds, fs in os.walk(base):
Expand Down

0 comments on commit 6a4858a

Please sign in to comment.