Skip to content

Commit

Permalink
Merge pull request #24 from flavien-hugs/fix/blacklist-token-file
Browse files Browse the repository at this point in the history
fix encoding
  • Loading branch information
flavien-hugs authored Aug 11, 2024
2 parents e4f54f3 + cc8a340 commit 073d49f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/shared/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def init_blacklist_token_file(self) -> bool:

async def add_blacklist_token(self, token: str) -> bool:
try:
with open(file=self._token_file, mode="a") as file:
with open(file=self._token_file, mode="a", encoding="utf-8") as file:
file.write(f"{token},")
logger.info("Adding token to blacklist file !")
except IOError as e:
Expand All @@ -80,7 +80,7 @@ async def add_blacklist_token(self, token: str) -> bool:

async def is_token_blacklisted(self, token: str) -> bool:
try:
with open(file=self._token_file) as file:
with open(file=self._token_file, encoding="utf-8") as file:
content = file.read()
tokens = content.rstrip(",").split(",")
logger.info("The token already exists in the blacklist !")
Expand Down

0 comments on commit 073d49f

Please sign in to comment.