mirror of
https://github.com/go-gitea/gitea
synced 2025-07-05 10:07:22 +00:00
Email option to embed images as base64 instead of link (#32061)
ref: #15081 ref: #14037 Documentation: https://gitea.com/gitea/docs/pulls/69 # Example Content:  Result in Email:  Result with source code: (first image is external image, 2nd is now embedded)  --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@ -122,3 +122,26 @@ func TestIsCurrentGiteaSiteURL(t *testing.T) {
|
||||
assert.True(t, IsCurrentGiteaSiteURL(ctx, "https://user-host"))
|
||||
assert.False(t, IsCurrentGiteaSiteURL(ctx, "https://forwarded-host"))
|
||||
}
|
||||
|
||||
func TestParseGiteaSiteURL(t *testing.T) {
|
||||
defer test.MockVariableValue(&setting.AppURL, "http://localhost:3000/sub/")()
|
||||
defer test.MockVariableValue(&setting.AppSubURL, "/sub")()
|
||||
ctx := t.Context()
|
||||
tests := []struct {
|
||||
url string
|
||||
exp *GiteaSiteURL
|
||||
}{
|
||||
{"http://localhost:3000/sub?k=v", &GiteaSiteURL{RoutePath: ""}},
|
||||
{"http://localhost:3000/sub/", &GiteaSiteURL{RoutePath: ""}},
|
||||
{"http://localhost:3000/sub/foo", &GiteaSiteURL{RoutePath: "/foo"}},
|
||||
{"http://localhost:3000/sub/foo/bar", &GiteaSiteURL{RoutePath: "/foo/bar", OwnerName: "foo", RepoName: "bar"}},
|
||||
{"http://localhost:3000/sub/foo/bar/", &GiteaSiteURL{RoutePath: "/foo/bar", OwnerName: "foo", RepoName: "bar"}},
|
||||
{"http://localhost:3000/sub/attachments/bar", &GiteaSiteURL{RoutePath: "/attachments/bar"}},
|
||||
{"http://localhost:3000/other", nil},
|
||||
{"http://other/", nil},
|
||||
}
|
||||
for _, test := range tests {
|
||||
su := ParseGiteaSiteURL(ctx, test.url)
|
||||
assert.Equal(t, test.exp, su, "URL = %s", test.url)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user