Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-22 01:44:24 +01:00

Linter fix: Rename UrlPrefix => URLPrefix

This commit is contained in:
Nirmal Kumar R 2024-11-04 23:56:35 +00:00
parent 4e700f5727
commit 27d05b69b5
3 changed files with 10 additions and 10 deletions

View file

@ -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,
}

View file

@ -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,

View file

@ -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,