Skip to content

Commit

Permalink
fix: base64 encoding at update pray
Browse files Browse the repository at this point in the history
  • Loading branch information
baebae02 committed Nov 8, 2023
1 parent b022f99 commit 89c04d5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app/utils/pray.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,8 @@ def update_storage(storage_id, content) -> StorageDTO:
if 'pray_cnt' in content:
storage.pray_cnt = content['pray_cnt']
db.session.commit()
except Exception:
except Exception as E:
print(E)
raise StorageFail('update storage error')
return StorageDTO(
id=storage.id,
Expand Down Expand Up @@ -382,14 +383,15 @@ def update_pray(content, storage_id) -> PrayDTO:
raise PrayFail('can not update other user pray')
pray = Pray.query.filter_by(id=storage.pray_id).first()
if 'target' in content:
pray.target = content['target']
pray.target = base64.b64encode(content['target'].encode('utf-8')).decode('utf-8')
if 'title' in content:
pray.title = content['title']
pray.title = base64.b64encode(content['title'].encode('utf-8')).decode('utf-8')
if 'deadline' in content:
storage.deadline = content['deadline']
db.session.commit()
return StorageService.get_storage(storage_id)

except Exception:
except Exception as E:
print(E)
raise PrayFail('update pray error')

0 comments on commit 89c04d5

Please sign in to comment.