From 34356b4707cdff7cf57d6ce2981d3e536dc32ccb Mon Sep 17 00:00:00 2001 From: checktheroads Date: Sun, 13 Oct 2019 17:35:04 -0700 Subject: [PATCH] automatically add trailing / to favicon path --- hyperglass/configuration/models/branding.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hyperglass/configuration/models/branding.py b/hyperglass/configuration/models/branding.py index c22b08e..d769b91 100644 --- a/hyperglass/configuration/models/branding.py +++ b/hyperglass/configuration/models/branding.py @@ -60,6 +60,16 @@ class Branding(HyperglassModel): width: int = 384 favicons: str = "ui/images/favicons/" + @validator("favicons") + def favicons_trailing_slash(value): + """ + If the favicons path does not end in a '/', append it. + """ + chars = [char for char in value] + if chars[len(chars) - 1] != "/": + chars.append("/") + return "".join(chars) + class PeeringDb(HyperglassModel): """Class model for params.branding.peering_db"""