Skip to content

Commit

Permalink
Merge pull request #76 from SelfhostedPro/yaml-templates
Browse files Browse the repository at this point in the history
added removal of whitespace to the right of a template URL to prevent…
  • Loading branch information
SelfhostedPro authored Sep 16, 2020
2 parents f432cc2 + 043e2c6 commit 1779228
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backend/api/db/crud/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ def add_template(db: Session, template: models.containers.Template):
_template = models.containers.Template(
title=template.title, url=template.url)
with urllib.request.urlopen(template.url) as file:
if ext in (".yml", '.yaml'):
if ext.rstrip() in (".yml", '.yaml'):
loaded_file = yaml.load(file, Loader=yaml.SafeLoader)
elif ext in (".json"):
elif ext.rstrip() in (".json", "json"):
loaded_file = json.load(file)
else:
print('Invalid filetype')
Expand Down

0 comments on commit 1779228

Please sign in to comment.