Skip to content

Commit

Permalink
Revert path change
Browse files Browse the repository at this point in the history
  • Loading branch information
ahopkins committed Dec 22, 2024
1 parent d6e0ee9 commit 5ae0b94
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions sanic/mixins/static.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,15 @@ def _register_static(
Register a static directory handler with Sanic by adding a route to the
router and registering a handler.
"""
file_or_directory: PathLike

if isinstance(static.file_or_directory, bytes):
file_or_directory = Path(static.file_or_directory.decode("utf-8"))
file_or_directory = static.file_or_directory.decode("utf-8")
elif isinstance(static.file_or_directory, PurePath):
file_or_directory = static.file_or_directory
elif isinstance(static.file_or_directory, str):
file_or_directory = Path(static.file_or_directory)
else:
file_or_directory = str(static.file_or_directory)
elif not isinstance(static.file_or_directory, str):
raise ValueError("Invalid file path string.")
else:
file_or_directory = static.file_or_directory

uri = static.uri
name = static.name
Expand Down

0 comments on commit 5ae0b94

Please sign in to comment.