diff --git a/routers/web/pages/pages.go b/routers/web/pages/pages.go index 5f25739ed6..28452e4cf1 100644 --- a/routers/web/pages/pages.go +++ b/routers/web/pages/pages.go @@ -71,7 +71,8 @@ func ServeLandingPage(ctx *context.Context) { } // Handle asset requests (gallery images, custom assets) - if assetPath, found := strings.CutPrefix(requestPath, "/assets/"); found && assetPath != "" { + // Uses /pages/assets/ to avoid conflict with Gitea's static /assets/ route + if assetPath, found := strings.CutPrefix(requestPath, "/pages/assets/"); found && assetPath != "" { serveCustomDomainAsset(ctx, repo, assetPath) return } @@ -183,12 +184,12 @@ func setupLandingPageContext(ctx *context.Context, repo *repo_model.Repository, // galleryAssetBaseURL returns the base URL for gallery image assets. // For repo-path mode (ctx.Repo is set), it returns /{owner}/{repo}/pages/assets/gallery/ -// For custom domain / subdomain mode, it returns /assets/gallery/ +// For custom domain / subdomain mode, it returns /pages/assets/gallery/ func galleryAssetBaseURL(ctx *context.Context, repo *repo_model.Repository) string { if ctx.Repo != nil && ctx.Repo.Repository != nil { return repo.Link() + "/pages/assets/gallery/" } - return "/assets/gallery/" + return "/pages/assets/gallery/" } // renderLandingPage renders the landing page based on the template