go blobserver: fix crash if short blobrefs requested.

This commit is contained in:
Brad Fitzpatrick 2011-01-31 10:19:37 -08:00
parent 66e6831b9d
commit adf13c6123
1 changed files with 3 additions and 0 deletions

View File

@ -52,6 +52,9 @@ func BlobFileBaseName(b *blobref.BlobRef) string {
func BlobDirectoryName(b *blobref.BlobRef) string {
d := b.Digest()
if len(d) < 6 {
d = d + "______"
}
return fmt.Sprintf("%s/%s/%s/%s", *flagStorageRoot, b.HashName(), d[0:3], d[3:6])
}