From 1ae0411d419d2178727048021f8dc09b6ccd1d82 Mon Sep 17 00:00:00 2001 From: holisticode Date: Fri, 6 Oct 2017 08:45:54 -0500 Subject: swarm/api: fixed 404 handling on missing default entry (#15139) --- swarm/api/api.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'swarm/api/api.go') diff --git a/swarm/api/api.go b/swarm/api/api.go index a5941fb5c..79de29a1c 100644 --- a/swarm/api/api.go +++ b/swarm/api/api.go @@ -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) -- cgit