MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / fetchChecksums

Function fetchChecksums

pkg/go/cmd/codebase-memory-mcp/main.go:218–242  ·  view source on GitHub ↗
(url string)

Source from the content-addressed store, hash-verified

216}
217
218func fetchChecksums(url string) (map[string]string, error) {
219 if err := validateURLScheme(url); err != nil {
220 return nil, err
221 }
222 resp, err := httpsOnlyClient.Get(url) //nolint:gosec
223 if err != nil {
224 return nil, err
225 }
226 defer resp.Body.Close()
227 if resp.StatusCode != http.StatusOK {
228 return nil, fmt.Errorf("HTTP %d", resp.StatusCode)
229 }
230 body, err := io.ReadAll(resp.Body)
231 if err != nil {
232 return nil, err
233 }
234 result := make(map[string]string)
235 for _, line := range strings.Split(string(body), "\n") {
236 parts := strings.Fields(line)
237 if len(parts) == 2 {
238 result[parts[1]] = parts[0]
239 }
240 }
241 return result, nil
242}
243
244func verifyChecksum(path, expected string) error {
245 f, err := os.Open(path)

Callers 1

downloadFunction · 0.85

Calls 1

validateURLSchemeFunction · 0.85

Tested by

no test coverage detected