MCPcopy
hub / github.com/mattermost/mattermost / GetSubpathFromConfig

Function GetSubpathFromConfig

server/channels/utils/subpath.go:199–216  ·  view source on GitHub ↗
(config *model.Config)

Source from the content-addressed store, hash-verified

197}
198
199func 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}

Callers 2

RenderWebErrorFunction · 0.85

Calls 2

ParseMethod · 0.45
WrapMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…