Commit 4d340af8 authored by Jeromy Johnson's avatar Jeromy Johnson Committed by GitHub

Merge pull request #41 from ipfs/fix/omit-slash

omit slash from created dskeys
parents 7a618be1 f098817c
......@@ -56,9 +56,10 @@ func New(path string, prefixLen int, sync bool) (*Datastore, error) {
var padding = strings.Repeat("_", maxPrefixLen)
func (fs *Datastore) encode(key datastore.Key) (dir, file string) {
prefix := (key.String() + padding)[:fs.prefixLen]
noslash := key.String()[1:]
prefix := (noslash + padding)[:fs.prefixLen]
dir = path.Join(fs.path, prefix)
file = path.Join(dir, key.String()+extension)
file = path.Join(dir, noslash+extension)
return dir, file
}
......
......@@ -152,7 +152,7 @@ func TestStorage(t *testing.T) {
defer cleanup()
const prefixLen = 2
const prefix = "q"
const prefix = "qu"
const target = prefix + string(os.PathSeparator) + "quux.data"
fs, err := flatfs.New(temp, prefixLen, false)
if err != nil {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment