wwwlll
commited on
Commit
·
e92c050
1
Parent(s):
920f3c8
Fix thumbnail_img NoneType error (#2941)
Browse files### What problem does this PR solve?
fix thumbnail_img NoneType error
### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
- api/utils/file_utils.py +5 -2
api/utils/file_utils.py
CHANGED
@@ -199,8 +199,11 @@ def thumbnail_img(filename, blob):
|
|
199 |
|
200 |
def thumbnail(filename, blob):
|
201 |
img = thumbnail_img(filename, blob)
|
202 |
-
|
203 |
-
|
|
|
|
|
|
|
204 |
|
205 |
def traversal_files(base):
|
206 |
for root, ds, fs in os.walk(base):
|
|
|
199 |
|
200 |
def thumbnail(filename, blob):
|
201 |
img = thumbnail_img(filename, blob)
|
202 |
+
if img is not None:
|
203 |
+
return IMG_BASE64_PREFIX + \
|
204 |
+
base64.b64encode(img).decode("utf-8")
|
205 |
+
else:
|
206 |
+
return ''
|
207 |
|
208 |
def traversal_files(base):
|
209 |
for root, ds, fs in os.walk(base):
|