From 27d05b69b5c9bcdda9a0ab46166b77cdf05b1fb7 Mon Sep 17 00:00:00 2001 From: Nirmal Kumar R Date: Mon, 4 Nov 2024 23:56:35 +0000 Subject: [PATCH] Linter fix: Rename UrlPrefix => URLPrefix --- routers/api/v1/misc/markup.go | 4 ++-- routers/common/markup.go | 14 +++++++------- routers/web/misc/markup.go | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/routers/api/v1/misc/markup.go b/routers/api/v1/misc/markup.go index e9d6617fb7..94046c1352 100644 --- a/routers/api/v1/misc/markup.go +++ b/routers/api/v1/misc/markup.go @@ -44,7 +44,7 @@ func Markup(ctx *context.APIContext) { re := common.Renderer{ Mode: form.Mode, Text: form.Text, - UrlPrefix: form.Context, + URLPrefix: form.Context, FilePath: form.FilePath, BranchPath: form.BranchPath, RelativePath: form.RelativePath, @@ -89,7 +89,7 @@ func Markdown(ctx *context.APIContext) { re := common.Renderer{ Mode: mode, Text: form.Text, - UrlPrefix: form.Context, + URLPrefix: form.Context, IsWiki: form.Wiki, } diff --git a/routers/common/markup.go b/routers/common/markup.go index 4c17c48e99..7e11d88e93 100644 --- a/routers/common/markup.go +++ b/routers/common/markup.go @@ -19,7 +19,7 @@ import ( ) type Renderer struct { - Mode, Text, UrlPrefix, FilePath, BranchPath, RelativePath string + Mode, Text, URLPrefix, FilePath, BranchPath, RelativePath string IsWiki bool } @@ -40,7 +40,7 @@ func (re *Renderer) RenderMarkup(ctx *context.Base, repo *context.Repository) { Ctx: ctx, Links: markup.Links{ AbsolutePrefix: true, - Base: re.UrlPrefix, + Base: re.URLPrefix, }, }, strings.NewReader(re.Text), ctx.Resp); err != nil { ctx.Error(http.StatusInternalServerError, err.Error()) @@ -55,19 +55,19 @@ func (re *Renderer) RenderMarkup(ctx *context.Base, repo *context.Repository) { case "file": // File as document based on file extension markupType = "" - re.UrlPrefix = re.RelativePath + re.URLPrefix = re.RelativePath relativePath = re.FilePath default: ctx.Error(http.StatusUnprocessableEntity, fmt.Sprintf("Unknown mode: %s", re.Mode)) return } - if !strings.HasPrefix(setting.AppSubURL+"/", re.UrlPrefix) { + if !strings.HasPrefix(setting.AppSubURL+"/", re.URLPrefix) { // check if urlPrefix is already set to a URL linkRegex, _ := xurls.StrictMatchingScheme("https?://") - m := linkRegex.FindStringIndex(re.UrlPrefix) + m := linkRegex.FindStringIndex(re.URLPrefix) if m == nil { - re.UrlPrefix = util.URLJoin(setting.AppURL, re.UrlPrefix) + re.URLPrefix = util.URLJoin(setting.AppURL, re.URLPrefix) } } @@ -87,7 +87,7 @@ func (re *Renderer) RenderMarkup(ctx *context.Base, repo *context.Repository) { Ctx: ctx, Links: markup.Links{ AbsolutePrefix: true, - Base: re.UrlPrefix, + Base: re.URLPrefix, BranchPath: re.BranchPath, }, Metas: meta, diff --git a/routers/web/misc/markup.go b/routers/web/misc/markup.go index f35158fa9e..e9a6f951d1 100644 --- a/routers/web/misc/markup.go +++ b/routers/web/misc/markup.go @@ -18,7 +18,7 @@ func Markup(ctx *context.Context) { re := common.Renderer{ Mode: form.Mode, Text: form.Text, - UrlPrefix: form.Context, + URLPrefix: form.Context, FilePath: form.FilePath, BranchPath: form.BranchPath, RelativePath: form.RelativePath,