Skip to content

Commit

Permalink
Better handle case of item with no creators
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs committed Nov 28, 2024
1 parent a78adb5 commit b0a65ff
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pydatalab/src/pydatalab/routes/v0_1/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,11 +659,11 @@ def update_item_permissions(refcode: str):
# The first ID in the creator list takes precedence; always make sure this is included to avoid orphaned items
if current_creator_ids:
base_owner = current_creator_ids[0]
try:
creator_ids.remove(base_owner)
except ValueError:
pass
creator_ids.insert(0, base_owner)
try:
creator_ids.remove(base_owner)
except ValueError:
pass
creator_ids.insert(0, base_owner)

LOGGER.warning("Setting permissions for item %s to %s", refcode, creator_ids)
result = flask_mongo.db.items.update_one(
Expand Down

0 comments on commit b0a65ff

Please sign in to comment.