diff options
author | Yondon Fu <yondon.fu@gmail.com> | 2017-12-19 06:17:41 +0800 |
---|---|---|
committer | Yondon Fu <yondon.fu@gmail.com> | 2017-12-19 06:17:41 +0800 |
commit | 3857cdc267e3192697f561df0a0f827f65dfb6b5 (patch) | |
tree | 401c52c4972a68229ea283a394a0b0a5f3cfdc8e /swarm/api/manifest.go | |
parent | a5330fe0c569b75cb8a524f60f7e8dc06498262b (diff) | |
parent | fe070ab5c32702033489f1b9d1655ea1b894c29e (diff) | |
download | dexon-3857cdc267e3192697f561df0a0f827f65dfb6b5.tar dexon-3857cdc267e3192697f561df0a0f827f65dfb6b5.tar.gz dexon-3857cdc267e3192697f561df0a0f827f65dfb6b5.tar.bz2 dexon-3857cdc267e3192697f561df0a0f827f65dfb6b5.tar.lz dexon-3857cdc267e3192697f561df0a0f827f65dfb6b5.tar.xz dexon-3857cdc267e3192697f561df0a0f827f65dfb6b5.tar.zst dexon-3857cdc267e3192697f561df0a0f827f65dfb6b5.zip |
Merge branch 'master' into abi-offset-fixed-arrays
Diffstat (limited to 'swarm/api/manifest.go')
-rw-r--r-- | swarm/api/manifest.go | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/swarm/api/manifest.go b/swarm/api/manifest.go index d3eced198..685a300fc 100644 --- a/swarm/api/manifest.go +++ b/swarm/api/manifest.go @@ -238,7 +238,7 @@ func (self *manifestTrie) addEntry(entry *manifestTrieEntry, quitC chan bool) { return } - b := byte(entry.Path[0]) + b := entry.Path[0] oldentry := self.entries[b] if (oldentry == nil) || (oldentry.Path == entry.Path && oldentry.ContentType != ManifestType) { self.entries[b] = entry @@ -294,7 +294,7 @@ func (self *manifestTrie) deleteEntry(path string, quitC chan bool) { return } - b := byte(path[0]) + b := path[0] entry := self.entries[b] if entry == nil { return @@ -425,7 +425,7 @@ func (self *manifestTrie) findPrefixOf(path string, quitC chan bool) (entry *man } //see if first char is in manifest entries - b := byte(path[0]) + b := path[0] entry = self.entries[b] if entry == nil { return self.entries[256], 0 @@ -436,6 +436,16 @@ func (self *manifestTrie) findPrefixOf(path string, quitC chan bool) (entry *man if len(path) <= epl { if entry.Path[:len(path)] == path { if entry.ContentType == ManifestType { + err := self.loadSubTrie(entry, quitC) + if err == nil && entry.subtrie != nil { + subentries := entry.subtrie.entries + for i := 0; i < len(subentries); i++ { + sub := subentries[i] + if sub != nil && sub.Path == "" { + return sub, len(path) + } + } + } entry.Status = http.StatusMultipleChoices } pos = len(path) |