diff --git a/routers/web/pages/pages.go b/routers/web/pages/pages.go index 7661314375..af0151631a 100644 --- a/routers/web/pages/pages.go +++ b/routers/web/pages/pages.go @@ -58,8 +58,7 @@ func ServeLandingPage(ctx *context.Context) { // Check for blog paths on custom domain if config.Blog.Enabled && repo.BlogEnabled { - if strings.HasPrefix(requestPath, "/blog/") { - idStr := strings.TrimPrefix(requestPath, "/blog/") + if idStr, found := strings.CutPrefix(requestPath, "/blog/"); found { idStr = strings.TrimRight(idStr, "/") blogID, err := strconv.ParseInt(idStr, 10, 64) if err == nil && blogID > 0 {