diff options
author | Janos Guljas <janos@resenje.org> | 2017-12-05 05:56:52 +0800 |
---|---|---|
committer | Janos Guljas <janos@resenje.org> | 2017-12-05 05:56:52 +0800 |
commit | 1dc19de5da64962a98a37bbc7b93a3895d2eb6e6 (patch) | |
tree | 6072f4a04bf8569dfef730ad03be81ee9f1d9cae /swarm/api | |
parent | e451b65faef95b159c38a607f716866e7bd3310f (diff) | |
download | go-tangerine-1dc19de5da64962a98a37bbc7b93a3895d2eb6e6.tar go-tangerine-1dc19de5da64962a98a37bbc7b93a3895d2eb6e6.tar.gz go-tangerine-1dc19de5da64962a98a37bbc7b93a3895d2eb6e6.tar.bz2 go-tangerine-1dc19de5da64962a98a37bbc7b93a3895d2eb6e6.tar.lz go-tangerine-1dc19de5da64962a98a37bbc7b93a3895d2eb6e6.tar.xz go-tangerine-1dc19de5da64962a98a37bbc7b93a3895d2eb6e6.tar.zst go-tangerine-1dc19de5da64962a98a37bbc7b93a3895d2eb6e6.zip |
swarm/api: use path.Ext instead strings.LastIndex in MultiResolver.Resolve
Diffstat (limited to 'swarm/api')
-rw-r--r-- | swarm/api/api.go | 5 |
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 } |