cms_site_detect should just return nil if there is no request object
Actual behavior
If there is no rails request object (request == nil) cms_site_detect raises an error
Steps to reproduce
Try it in a server side test spec for example, where perhaps there is no CMS environment. Old behavior (comfy v 1.12 for example) was just to return a blank string when rendering if there was no site. Comfy > v 1.12 no raises an error.
Here is a patch:
module Comfy
module CmsHelper
def cms_site_detect
return nil unless request
host = request.host_with_port.downcase
path = request.fullpath
Comfy::Cms::Site.find_site(host, path)
end
end
end
Expected behavior
cms_site_detect should just return nil if there is no request object
Actual behavior
If there is no rails
request
object (request == nil)cms_site_detect
raises an errorSteps to reproduce
Try it in a server side test spec for example, where perhaps there is no CMS environment. Old behavior (comfy v 1.12 for example) was just to return a blank string when rendering if there was no site. Comfy > v 1.12 no raises an error.
Here is a patch:
System configuration
CMS version: