Remove duplicate call LastIndex (#41)
This commit is contained in:
parent
26233c635c
commit
f1751aff86
1 changed files with 3 additions and 2 deletions
5
main.go
5
main.go
|
@ -67,13 +67,14 @@ func assetDelivery(res http.ResponseWriter, r *http.Request) {
|
||||||
assetName = "/index.html"
|
assetName = "/index.html"
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.LastIndex(assetName, ".") < 0 {
|
dot := strings.LastIndex(assetName, ".")
|
||||||
|
if dot < 0 {
|
||||||
// There are no assets with no dot in it
|
// There are no assets with no dot in it
|
||||||
http.Error(res, "404 not found", http.StatusNotFound)
|
http.Error(res, "404 not found", http.StatusNotFound)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ext := assetName[strings.LastIndex(assetName, "."):]
|
ext := assetName[dot:]
|
||||||
assetData, err := Asset(path.Join("frontend", assetName))
|
assetData, err := Asset(path.Join("frontend", assetName))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(res, "404 not found", http.StatusNotFound)
|
http.Error(res, "404 not found", http.StatusNotFound)
|
||||||
|
|
Loading…
Reference in a new issue