Skip to content

Commit

Permalink
fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
violetamedallia committed Apr 2, 2024
1 parent 04549aa commit 384d928
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/service/Users.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,12 @@ def update_user(self, user_id: int, update_data: dict):
# es el propio usuario editando sus datos y no permitir
# que un usuario edite los de un tercero
self.get_user(user_id)
filtered_update_data = {k: v for k, v in update_data.items()
if v is not None}
filtered_update_data = {k: v for k, v in update_data.items()
if v is not None}
if 'photo' in filtered_update_data:
photo_url = filtered_update_data['photo']
if not re.match(r'^https?://(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,6}'
r'(?:/[^/#?]+)+\.(?:jpg|jpeg|png|gif)$', photo_url):
r'(?:/[^/#?]+)+\.(?:jpg|jpeg|png|gif)$',
photo_url):
raise InvalidURL("Invalid photo URL")
self.user_repository.edit_user(user_id, filtered_update_data)

0 comments on commit 384d928

Please sign in to comment.