aboutsummaryrefslogtreecommitdiffstats
path: root/modules/markup
diff options
context:
space:
mode:
authorChristian Muehlhaeuser <muesli@gmail.com>2019-07-23 20:50:39 +0200
committerzeripath <art27@cantab.net>2019-07-23 19:50:39 +0100
commit54d96c79b5b9f3d5d47aed59729ae779968fbecb (patch)
tree3d74fa2aecf3a9c5a23a1ec0c7e66fca270216aa /modules/markup
parent2f75766532fbf30883c05e93ef01c19268216c45 (diff)
downloadgitea-54d96c79b5b9f3d5d47aed59729ae779968fbecb.tar.gz
gitea-54d96c79b5b9f3d5d47aed59729ae779968fbecb.zip
Removed unnecessary conversions (#7557)
No need to convert to the same type.
Diffstat (limited to 'modules/markup')
-rw-r--r--modules/markup/html.go4
-rw-r--r--modules/markup/html_test.go12
-rw-r--r--modules/markup/markdown/markdown_test.go4
3 files changed, 10 insertions, 10 deletions
diff --git a/modules/markup/html.go b/modules/markup/html.go
index 3e976929c7..825a41dd1f 100644
--- a/modules/markup/html.go
+++ b/modules/markup/html.go
@@ -438,7 +438,7 @@ func shortLinkProcessorFull(ctx *postProcessCtx, node *html.Node, noLink bool) {
name += tail
image := false
- switch ext := filepath.Ext(string(link)); ext {
+ switch ext := filepath.Ext(link); ext {
// fast path: empty string, ignore
case "":
break
@@ -482,7 +482,7 @@ func shortLinkProcessorFull(ctx *postProcessCtx, node *html.Node, noLink bool) {
title = props["alt"]
}
if title == "" {
- title = path.Base(string(name))
+ title = path.Base(name)
}
alt := props["alt"]
if alt == "" {
diff --git a/modules/markup/html_test.go b/modules/markup/html_test.go
index daf953c9e6..be7fb0efc5 100644
--- a/modules/markup/html_test.go
+++ b/modules/markup/html_test.go
@@ -27,7 +27,7 @@ func TestRender_Commits(t *testing.T) {
test := func(input, expected string) {
buffer := RenderString(".md", input, setting.AppSubURL, localMetas)
- assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(string(buffer)))
+ assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(buffer))
}
var sha = "b6dd6210eaebc915fd5be5579c58cce4da2e2579"
@@ -51,7 +51,7 @@ func TestRender_CrossReferences(t *testing.T) {
test := func(input, expected string) {
buffer := RenderString("a.md", input, setting.AppSubURL, localMetas)
- assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(string(buffer)))
+ assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(buffer))
}
test(
@@ -83,7 +83,7 @@ func TestRender_links(t *testing.T) {
test := func(input, expected string) {
buffer := RenderString("a.md", input, setting.AppSubURL, nil)
- assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(string(buffer)))
+ assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(buffer))
}
// Text that should be turned into URL
@@ -160,7 +160,7 @@ func TestRender_email(t *testing.T) {
test := func(input, expected string) {
buffer := RenderString("a.md", input, setting.AppSubURL, nil)
- assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(string(buffer)))
+ assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(buffer))
}
// Text that should be turned into email link
@@ -214,9 +214,9 @@ func TestRender_ShortLinks(t *testing.T) {
test := func(input, expected, expectedWiki string) {
buffer := markdown.RenderString(input, tree, nil)
- assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(string(buffer)))
+ assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(buffer))
buffer = markdown.RenderWiki([]byte(input), setting.AppSubURL, localMetas)
- assert.Equal(t, strings.TrimSpace(expectedWiki), strings.TrimSpace(string(buffer)))
+ assert.Equal(t, strings.TrimSpace(expectedWiki), strings.TrimSpace(buffer))
}
rawtree := util.URLJoin(AppSubURL, "raw", "master")
diff --git a/modules/markup/markdown/markdown_test.go b/modules/markup/markdown/markdown_test.go
index 2128639b9f..92b4f03e34 100644
--- a/modules/markup/markdown/markdown_test.go
+++ b/modules/markup/markdown/markdown_test.go
@@ -31,7 +31,7 @@ func TestRender_StandardLinks(t *testing.T) {
test := func(input, expected, expectedWiki string) {
buffer := RenderString(input, setting.AppSubURL, nil)
- assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(string(buffer)))
+ assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(buffer))
bufferWiki := RenderWiki([]byte(input), setting.AppSubURL, nil)
assert.Equal(t, strings.TrimSpace(expectedWiki), strings.TrimSpace(bufferWiki))
}
@@ -74,7 +74,7 @@ func TestRender_Images(t *testing.T) {
test := func(input, expected string) {
buffer := RenderString(input, setting.AppSubURL, nil)
- assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(string(buffer)))
+ assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(buffer))
}
url := "../../.images/src/02/train.jpg"