| 151 | } |
| 152 | |
| 153 | static ExtensionRepoInfo getExtensionRepoInfo(const std::string& extensionURL) { |
| 154 | auto parsedURL = parseURL(extensionURL); |
| 155 | auto scheme = parsedURL.scheme.empty() ? "http" : parsedURL.scheme; |
| 156 | auto hostStart = extensionURL.find("://"); |
| 157 | hostStart = hostStart == std::string::npos ? 0 : hostStart + 3; |
| 158 | auto hostPathStart = extensionURL.find('/', hostStart); |
| 159 | auto hostName = hostPathStart == std::string::npos ? |
| 160 | extensionURL.substr(hostStart) : |
| 161 | extensionURL.substr(hostStart, hostPathStart - hostStart); |
| 162 | auto hostURL = std::format("{}://{}", scheme, hostName); |
| 163 | auto hostPath = hostPathStart == std::string::npos ? "/" : extensionURL.substr(hostPathStart); |
| 164 | return {hostPath, hostURL, extensionURL}; |
| 165 | } |
| 166 | |
| 167 | std::string ExtensionSourceUtils::toString(ExtensionSource source) { |
| 168 | switch (source) { |
no test coverage detected