diff --git a/cmd/mtwebmapper/subbaseline.go b/cmd/mtwebmapper/subbaseline.go index b714569..a9b2c35 100644 --- a/cmd/mtwebmapper/subbaseline.go +++ b/cmd/mtwebmapper/subbaseline.go @@ -41,7 +41,7 @@ func (sb *subBaseLine) ServeHTTP(rw http.ResponseWriter, r *http.Request) { http.ServeFile(rw, r, filepath.Join(sb.mapDir, strconv.Itoa(int(z)), strconv.Itoa(int(x)), - fmt.Sprintf("%d.png", y))) + strconv.Itoa(int(y))+".png")) return } @@ -52,7 +52,10 @@ func (sb *subBaseLine) ServeHTTP(rw http.ResponseWriter, r *http.Request) { ty := y >> (z - 8) baseTile := filepath.Join( - sb.mapDir, "8", strconv.Itoa(int(tx)), fmt.Sprintf("%d.png", ty)) + sb.mapDir, + "8", + strconv.Itoa(int(tx)), + strconv.Itoa(int(ty))+".png") var err error var fi os.FileInfo @@ -61,11 +64,7 @@ func (sb *subBaseLine) ServeHTTP(rw http.ResponseWriter, r *http.Request) { return } - if checkLastModified(rw, r, fi.ModTime()) { - return - } - - if checkETag(rw, r, fi) { + if checkLastModified(rw, r, fi.ModTime()) || checkETag(rw, r, fi) { return } @@ -99,7 +98,6 @@ func (sb *subBaseLine) ServeHTTP(rw http.ResponseWriter, r *http.Request) { rw.Header().Set("Content-Type", "image/png") if err = png.Encode(rw, img); err != nil { log.Printf("WARN: encoding image failed: %s", err) - return } } diff --git a/cmd/mtwebmapper/tilesupdater.go b/cmd/mtwebmapper/tilesupdater.go index cadd3ff..54100ac 100644 --- a/cmd/mtwebmapper/tilesupdater.go +++ b/cmd/mtwebmapper/tilesupdater.go @@ -255,7 +255,7 @@ func updatePyramidTile(scratch *image.RGBA, level int, baseDir string, j xzm) er baseDir, strconv.Itoa(level+1), strconv.Itoa(bx+o[0]), - fmt.Sprintf("%d.png", bz+o[1])) + strconv.Itoa(bz+o[1])+".png") img := common.LoadPNG(path) img = resize.Resize(128, 128, img, resize.Lanczos3) sr := img.Bounds()