Chore: Ensure BuildVersion is set when using CDN (#79169)

This commit is contained in:
Todd Treece
2023-12-06 15:27:08 -05:00
committed by GitHub
parent c4c9bfaf2e
commit ea36336c0a
3 changed files with 51 additions and 24 deletions
+9 -8
View File
@@ -1988,16 +1988,17 @@ func (cfg *Cfg) readServerSettings(iniFile *ini.File) error {
}
// GetContentDeliveryURL returns full content delivery URL with /<edition>/<version> added to URL
func (cfg *Cfg) GetContentDeliveryURL(prefix string) string {
if cfg.CDNRootURL != nil {
url := *cfg.CDNRootURL
preReleaseFolder := ""
url.Path = path.Join(url.Path, prefix, preReleaseFolder, cfg.BuildVersion)
return url.String() + "/"
func (cfg *Cfg) GetContentDeliveryURL(prefix string) (string, error) {
if cfg.CDNRootURL == nil {
return "", nil
}
if cfg.BuildVersion == "" {
return "", errors.New("BuildVersion is not set")
}
url := *cfg.CDNRootURL
return ""
url.Path = path.Join(url.Path, prefix, cfg.BuildVersion)
return url.String() + "/", nil
}
func (cfg *Cfg) readDataSourcesSettings() {