MCPcopy Create free account
hub / github.com/aptly-dev/aptly / LegacyPath

Method LegacyPath

files/package_pool.go:47–60  ·  view source on GitHub ↗

LegacyPath returns path relative to pool's root for pre-1.1 aptly (based on MD5)

(filename string, checksums *utils.ChecksumInfo)

Source from the content-addressed store, hash-verified

45
46// LegacyPath returns path relative to pool's root for pre-1.1 aptly (based on MD5)
47func (pool *PackagePool) LegacyPath(filename string, checksums *utils.ChecksumInfo) (string, error) {
48 filename = filepath.Base(filename)
49 if filename == "." || filename == "/" {
50 return "", fmt.Errorf("filename %s is invalid", filename)
51 }
52
53 hashMD5 := checksums.MD5
54
55 if len(hashMD5) < 4 {
56 return "", fmt.Errorf("unable to compute pool location for filename %v, MD5 is missing", filename)
57 }
58
59 return filepath.Join(hashMD5[0:2], hashMD5[2:4], filename), nil
60}
61
62// buildPoolPath generates pool path based on file checksum
63func (pool *PackagePool) buildPoolPath(filename string, checksums *utils.ChecksumInfo) (string, error) {

Callers 2

VerifyMethod · 0.95
ImportMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected