Upgraded to latest aero version

This commit is contained in:
2019-06-01 13:55:49 +09:00
parent ae591e5e7e
commit 28db818c37
196 changed files with 645 additions and 593 deletions

View File

@ -1,19 +1,20 @@
package utils
import (
"net/http"
"strings"
"github.com/aerogo/aero"
)
// SmartRedirect automatically adds the /_ prefix to the URI if required.
func SmartRedirect(ctx *aero.Context, uri string) string {
func SmartRedirect(ctx aero.Context, uri string) error {
// Redirect
prefix := ""
if strings.HasPrefix(ctx.URI(), "/_") {
if strings.HasPrefix(ctx.Path(), "/_") {
prefix = "/_"
}
return ctx.Redirect(prefix + uri)
return ctx.Redirect(http.StatusFound, prefix+uri)
}