Skip to content

Commit

Permalink
fix issue when long_url not save
Browse files Browse the repository at this point in the history
  • Loading branch information
hitnik committed Aug 21, 2021
1 parent e5727ca commit 229e536
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ def save_url(short, long):
if long_url_exist(long):
long_inst = get_long_url_from_db(url=long)
insert_short_url(short, long_inst[0])
else:
long_id = insert_long_url(long)
insert_short_url(short, long_id)
return short
else:
raise URLExistsError

0 comments on commit 229e536

Please sign in to comment.