Skip to content

Commit

Permalink
Remove trailing slashes (/) from root_path
Browse files Browse the repository at this point in the history
  • Loading branch information
CasperWA committed Mar 9, 2021
1 parent c2aa29b commit 1235326
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions optimade/server/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,14 @@ def set_implementation_version(cls, v):
res.update(v)
return res

@validator("root_path", pre=False)
def remove_end_slashes(cls, value: str) -> str:
"""Remove ending slashes from root_path"""
if isinstance(value, str):
while value.endswith("/"):
value = value[:-1]
return value

@root_validator(pre=True)
def load_settings(cls, values):
"""
Expand Down

0 comments on commit 1235326

Please sign in to comment.