Merge pull request #453 from ethersphere/fix_panic

swarm/api: move debug line to avoid panic
This commit is contained in:
Anton Evangelatov 2018-04-27 10:26:19 +02:00 committed by GitHub
commit 8ea9168558
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -321,9 +321,9 @@ func (self *Api) Get(key storage.Key, path string) (reader *storage.LazyChunkRea
log.Debug("trie getting entry", "key", key, "path", path)
entry, _ := trie.getEntry(path)
log.Debug("trie got entry", "key", key, "path", path, "entry.Hash", entry.Hash)
if entry != nil {
log.Debug("trie got entry", "key", key, "path", path, "entry.Hash", entry.Hash)
// we want to be able to serve Mutable Resource Updates transparently using the bzz:// scheme
//
// we use a special manifest hack for this purpose, which is pathless and where the resource root key
@ -337,6 +337,7 @@ func (self *Api) Get(key storage.Key, path string) (reader *storage.LazyChunkRea
return nil, entry.ContentType, http.StatusOK, &ErrResourceReturn{entry.Hash}
}
key = common.Hex2Bytes(entry.Hash)
log.Debug("trie key", "key", key)
status = entry.Status
if status == http.StatusMultipleChoices {
apiGetHttp300.Inc(1)