mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-04 11:55:30 -04:00
Check supplied base url has leading slash and append tailing slash if needed
This commit is contained in:
parent
48c3a82078
commit
4a245d2504
@ -42,6 +42,7 @@ class Config
|
||||
cfg_path = File.expand_path path, home: true
|
||||
if File.exists? cfg_path
|
||||
config = self.from_yaml File.read cfg_path
|
||||
config.preprocess
|
||||
config.fill_defaults
|
||||
return config
|
||||
end
|
||||
@ -71,4 +72,13 @@ class Config
|
||||
end
|
||||
{% end %}
|
||||
end
|
||||
|
||||
def preprocess
|
||||
unless base_url.starts_with? "/"
|
||||
raise "base url (#{base_url}) should start with `/`"
|
||||
end
|
||||
unless base_url.ends_with? "/"
|
||||
@base_url += "/"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user