v2 #43

Merged
h4kor merged 41 commits from v2 into main 2023-07-19 19:09:19 +00:00
4 changed files with 36 additions and 3 deletions
Showing only changes of commit 93184589bf - Show all commits

24
cmd/owl/media_test.go Normal file
View File

@ -0,0 +1,24 @@
package main
import (
"net/http/httptest"
"owl-blogs/test"
"testing"
"github.com/stretchr/testify/require"
)
func TestMediaWithSpace(t *testing.T) {
db := test.NewMockDb()
owlApp := App(db)
app := owlApp.FiberApp
_, err := owlApp.BinaryService.Create("name with space.jpg", []byte("111"))
require.NoError(t, err)
req := httptest.NewRequest("GET", "/media/name%20with%20space.jpg", nil)
resp, err := app.Test(req)
require.NoError(t, err)
require.Equal(t, 200, resp.StatusCode)
}

View File

@ -1,6 +1,10 @@
package entrytypes package entrytypes
import "owl-blogs/domain/model" import (
"fmt"
"owl-blogs/domain/model"
"owl-blogs/render"
)
type Note struct { type Note struct {
model.EntryBase model.EntryBase
@ -16,7 +20,11 @@ func (e *Note) Title() string {
} }
func (e *Note) Content() model.EntryContent { func (e *Note) Content() model.EntryContent {
return model.EntryContent(e.meta.Content) str, err := render.RenderTemplateToString("entry/Note", e)
if err != nil {
fmt.Println(err)
}
return model.EntryContent(str)
} }
func (e *Note) MetaData() interface{} { func (e *Note) MetaData() interface{} {

View File

@ -0,0 +1 @@
{{.MetaData.Content | markdown }}

View File

@ -1 +1 @@
{{.MetaData.Content}} {{.MetaData.Content | markdown }}