aboutsummaryrefslogtreecommitdiffstats
path: root/swarm/api
diff options
context:
space:
mode:
authorJanos Guljas <janos@resenje.org>2017-12-05 05:56:52 +0800
committerJanos Guljas <janos@resenje.org>2017-12-05 05:56:52 +0800
commit1dc19de5da64962a98a37bbc7b93a3895d2eb6e6 (patch)
tree6072f4a04bf8569dfef730ad03be81ee9f1d9cae /swarm/api
parente451b65faef95b159c38a607f716866e7bd3310f (diff)
downloaddexon-1dc19de5da64962a98a37bbc7b93a3895d2eb6e6.tar.gz
dexon-1dc19de5da64962a98a37bbc7b93a3895d2eb6e6.tar.zst
dexon-1dc19de5da64962a98a37bbc7b93a3895d2eb6e6.zip
swarm/api: use path.Ext instead strings.LastIndex in MultiResolver.Resolve
Diffstat (limited to 'swarm/api')
-rw-r--r--swarm/api/api.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/swarm/api/api.go b/swarm/api/api.go
index 8bd386643..2d9db022e 100644
--- a/swarm/api/api.go
+++ b/swarm/api/api.go
@@ -21,6 +21,7 @@ import (
"fmt"
"io"
"net/http"
+ "path"
"regexp"
"strings"
"sync"
@@ -83,8 +84,8 @@ func NewMultiResolver(opts ...MultiResolverOption) (m *MultiResolver) {
// will be returned.
func (m MultiResolver) Resolve(addr string) (h common.Hash, err error) {
rs := m.resolvers[""]
- if i := strings.LastIndex(addr, "."); i >= 0 {
- rstld, ok := m.resolvers[addr[i+1:]]
+ if ext := path.Ext(addr); ext != "" {
+ rstld, ok := m.resolvers[ext[1:]]
if ok {
rs = rstld
}