Skip to content

Commit

Permalink
better path handling
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisaaronland committed Mar 26, 2021
1 parent a7eaf73 commit 22470f7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions flags/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func ValidateWWWFlags(fs *flag.FlagSet) error {
if !geo.IsValidLongitude(minx) {
return errors.New("Invalid longitude, minx")
}

miny, err := strconv.ParseFloat(bounds[1], 64)

if err != nil {
Expand All @@ -107,7 +107,7 @@ func ValidateWWWFlags(fs *flag.FlagSet) error {
if !geo.IsValidLongitude(maxx) {
return errors.New("Invalid longitude, maxx")
}

maxy, err := strconv.ParseFloat(bounds[3], 64)

if err != nil {
Expand Down
11 changes: 6 additions & 5 deletions server/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,11 @@ func (server_app *HTTPServerApplication) RunWithFlagSet(ctx context.Context, fs
logger.Info("Register %s handler", path_pip)
mux.Handle(path_pip, http_pip_handler)

if !strings.HasSuffix(path_pip, "/") {
path_pip_slash := fmt.Sprintf("%s/", path_pip)
mux.Handle(path_pip_slash, http_pip_handler)
}

index_opts := &http.IndexHandlerOptions{
Templates: t,
}
Expand All @@ -329,11 +334,7 @@ func (server_app *HTTPServerApplication) RunWithFlagSet(ctx context.Context, fs

index_handler = bootstrap.AppendResourcesHandlerWithPrefix(index_handler, bootstrap_opts, path_prefix)

path_index := path_prefix

if path_index == "" {
path_index = "/"
}
path_index := "/"

logger.Info("Register %s handler", path_index)
mux.Handle(path_index, index_handler)
Expand Down

0 comments on commit 22470f7

Please sign in to comment.