(config *model.Config)
| 197 | } |
| 198 | |
| 199 | func GetSubpathFromConfig(config *model.Config) (string, error) { |
| 200 | if config == nil { |
| 201 | return "", errors.New("no config provided") |
| 202 | } else if config.ServiceSettings.SiteURL == nil { |
| 203 | return "/", nil |
| 204 | } |
| 205 | |
| 206 | u, err := url.Parse(*config.ServiceSettings.SiteURL) |
| 207 | if err != nil { |
| 208 | return "", errors.Wrap(err, "failed to parse SiteURL from config") |
| 209 | } |
| 210 | |
| 211 | if u.Path == "" { |
| 212 | return "/", nil |
| 213 | } |
| 214 | |
| 215 | return path.Clean(u.Path), nil |
| 216 | } |
no test coverage detected
searching dependent graphs…