fix: generate valid urls when app url contains a trailing slash (#257)

This commit is contained in:
2025-02-22 14:00:25 +00:00
parent 7446f853fc
commit e40ed50bed
6 changed files with 26 additions and 13 deletions

View File

@@ -1,13 +1,14 @@
package controller
import (
"github.com/pocket-id/pocket-id/backend/internal/common"
"github.com/pocket-id/pocket-id/backend/internal/utils/cookie"
"log"
"net/http"
"net/url"
"strings"
"github.com/pocket-id/pocket-id/backend/internal/common"
"github.com/pocket-id/pocket-id/backend/internal/utils/cookie"
"github.com/gin-gonic/gin"
"github.com/pocket-id/pocket-id/backend/internal/dto"
"github.com/pocket-id/pocket-id/backend/internal/middleware"
@@ -149,7 +150,7 @@ func (oc *OidcController) EndSessionHandler(c *gin.Context) {
if err != nil {
// If the validation fails, the user has to confirm the logout manually and doesn't get redirected
log.Printf("Error getting logout callback URL, the user has to confirm the logout manually: %v", err)
c.Redirect(http.StatusFound, common.EnvConfig.AppURL+"/logout")
c.Redirect(http.StatusFound, utils.GetAbsoluteURL(common.EnvConfig.AppURL, "/logout"))
return
}