forked from cerc-io/plugeth
swarm/api: use path.Ext instead strings.LastIndex in MultiResolver.Resolve
This commit is contained in:
parent
e451b65fae
commit
1dc19de5da
@ -21,6 +21,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"path"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
@ -83,8 +84,8 @@ func NewMultiResolver(opts ...MultiResolverOption) (m *MultiResolver) {
|
|||||||
// will be returned.
|
// will be returned.
|
||||||
func (m MultiResolver) Resolve(addr string) (h common.Hash, err error) {
|
func (m MultiResolver) Resolve(addr string) (h common.Hash, err error) {
|
||||||
rs := m.resolvers[""]
|
rs := m.resolvers[""]
|
||||||
if i := strings.LastIndex(addr, "."); i >= 0 {
|
if ext := path.Ext(addr); ext != "" {
|
||||||
rstld, ok := m.resolvers[addr[i+1:]]
|
rstld, ok := m.resolvers[ext[1:]]
|
||||||
if ok {
|
if ok {
|
||||||
rs = rstld
|
rs = rstld
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user