Skip to content

Commit

Permalink
modified logic to avoid directly reading lock file contents due to po…
Browse files Browse the repository at this point in the history
…ssible read/write permission issues
  • Loading branch information
benne238 committed Jul 12, 2021
1 parent e605dba commit 60254aa
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/webqueue2api/parser/item.py
Original file line number Diff line number Diff line change
Expand Up @@ -1096,11 +1096,9 @@ def __check_is_locked(self) -> Union[str, bool]:
"""
lock_file = str(self.path) + ".lck"
if os.path.exists(lock_file):
with open(lock_file) as file:
lock_info = file.readline().split(" ")
locked_by = lock_info[4]
locked_using = lock_info[1]
return f"{self.queue} {self.number} is locked by {locked_by} using {locked_using}"
lock_file = Path(lock_file)
lock_file_owner = lock_file.owner()
return f"{self.queue} {self.number} is locked by {lock_file_owner}."
else:
return False

Expand Down

0 comments on commit 60254aa

Please sign in to comment.