mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-20 09:44:26 +08:00
show error when specified map provider is not current provider when using map image proxy
This commit is contained in:
@@ -32,6 +32,10 @@ func (p *MapImageProxy) MapTileImageProxyHandler(c *core.Context) (*httputil.Rev
|
|||||||
mapProvider := strings.Replace(c.Query("provider"), "-", "_", -1)
|
mapProvider := strings.Replace(c.Query("provider"), "-", "_", -1)
|
||||||
targetUrl := ""
|
targetUrl := ""
|
||||||
|
|
||||||
|
if mapProvider != settings.Container.Current.MapProvider {
|
||||||
|
return nil, errs.ErrMapProviderNotCurrent
|
||||||
|
}
|
||||||
|
|
||||||
if mapProvider == settings.OpenStreetMapProvider {
|
if mapProvider == settings.OpenStreetMapProvider {
|
||||||
targetUrl = openStreetMapTileImageUrlFormat
|
targetUrl = openStreetMapTileImageUrlFormat
|
||||||
} else if mapProvider == settings.OpenStreetMapHumanitarianStyleProvider {
|
} else if mapProvider == settings.OpenStreetMapHumanitarianStyleProvider {
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ const (
|
|||||||
NormalSubcategoryCategory = 6
|
NormalSubcategoryCategory = 6
|
||||||
NormalSubcategoryTag = 7
|
NormalSubcategoryTag = 7
|
||||||
NormalSubcategoryDataManagement = 8
|
NormalSubcategoryDataManagement = 8
|
||||||
|
NormalSubcategoryMapProxy = 9
|
||||||
)
|
)
|
||||||
|
|
||||||
// Error represents the specific error returned to user
|
// Error represents the specific error returned to user
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package errs
|
||||||
|
|
||||||
|
import "net/http"
|
||||||
|
|
||||||
|
// Error codes related to map image proxy
|
||||||
|
var (
|
||||||
|
ErrMapProviderNotCurrent = NewNormalError(NormalSubcategoryMapProxy, 0, http.StatusBadRequest, "specified map provider is not set")
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user