Added redirects for other list services
This commit is contained in:
19
utils/SmartRedirect.go
Normal file
19
utils/SmartRedirect.go
Normal file
@ -0,0 +1,19 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
)
|
||||
|
||||
// SmartRedirect automatically adds the /_ prefix to the URI if required.
|
||||
func SmartRedirect(ctx *aero.Context, uri string) string {
|
||||
// Redirect
|
||||
prefix := ""
|
||||
|
||||
if strings.HasPrefix(ctx.URI(), "/_") {
|
||||
prefix = "/_"
|
||||
}
|
||||
|
||||
return ctx.Redirect(prefix + uri)
|
||||
}
|
Reference in New Issue
Block a user