swarm/api: fixed 404 handling on missing default entry (#15139)

This commit is contained in:
holisticode
2017-10-06 08:45:54 -05:00
committed by Felix Lange
parent d54e3539d4
commit 1ae0411d41
6 changed files with 311 additions and 39 deletions

View File

@ -144,9 +144,13 @@ func (self *Api) Get(key storage.Key, path string) (reader storage.LazySectionRe
if entry != nil {
key = common.Hex2Bytes(entry.Hash)
status = entry.Status
mimeType = entry.ContentType
log.Trace(fmt.Sprintf("content lookup key: '%v' (%v)", key, mimeType))
reader = self.dpa.Retrieve(key)
if status == http.StatusMultipleChoices {
return
} else {
mimeType = entry.ContentType
log.Trace(fmt.Sprintf("content lookup key: '%v' (%v)", key, mimeType))
reader = self.dpa.Retrieve(key)
}
} else {
status = http.StatusNotFound
err = fmt.Errorf("manifest entry for '%s' not found", path)