Commit 1dc19de5 authored by Janos Guljas's avatar Janos Guljas

swarm/api: use path.Ext instead strings.LastIndex in MultiResolver.Resolve

parent e451b65f
......@@ -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
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment