discoRoot returns the user defined server for this client. It prepends "https://" if no scheme was specified.
()
| 952 | |
| 953 | // discoRoot returns the user defined server for this client. It prepends "https://" if no scheme was specified. |
| 954 | func (c *Client) discoRoot() string { |
| 955 | s := c.server |
| 956 | if c.sameOrigin { |
| 957 | s = strings.TrimPrefix(s, "http://") |
| 958 | s = strings.TrimPrefix(s, "https://") |
| 959 | parts := strings.SplitN(s, "/", 1) |
| 960 | if len(parts) < 2 { |
| 961 | return "/" |
| 962 | } |
| 963 | return "/" + parts[1] |
| 964 | } |
| 965 | if !strings.HasPrefix(s, "http") { |
| 966 | s = "https://" + s |
| 967 | } |
| 968 | return s |
| 969 | } |
| 970 | |
| 971 | // initPrefix uses the user provided server URL to define the URL |
| 972 | // prefix to the blobserver root. If the server URL has a path |
no test coverage detected