Log missing hostName in Collection.RedirectingCanonicalURL

This is the crucial part where the hostName is needed for federation and
API clients. This change at least lets us know when we mess up like this
so the issue is easier to catch in the future.
pull/144/head
Matt Baer 5 years ago
parent f6f116d672
commit 4faf41ae7f
  1. 4
      collections.go

@ -211,6 +211,10 @@ func (c *Collection) DisplayCanonicalURL() string {
}
func (c *Collection) RedirectingCanonicalURL(isRedir bool) string {
if c.hostName == "" {
// If this is true, the human programmers screwed up. So ask for a bug report and fail, fail, fail
log.Error("[PROGRAMMER ERROR] WARNING: Collection.hostName is empty! Federation and many other things will fail! If you're seeing this in the wild, please report this bug and let us know what you were doing just before this: https://github.com/writeas/writefreely/issues/new?template=bug_report.md")
}
if isSingleUser {
return c.hostName + "/"
}

Loading…
Cancel
Save