relative image url/fix conflict when upload attachment again
This commit is contained in:
1 parent
f49624d3eb
commit
a8dd578624
24 files changed
+130
-106
No files matched your search
@@ -0,0 +1,32 @@
|
||||
package tests
|
||||
|
||||
import (
|
||||
"github.com/leanote/leanote/app/db"
|
||||
"github.com/revel/revel"
|
||||
"testing"
|
||||
// . "github.com/leanote/leanote/app/lea"
|
||||
"github.com/leanote/leanote/app/service"
|
||||
// "regexp"
|
||||
// "gopkg.in/mgo.v2"
|
||||
// "fmt"
|
||||
// "strings"
|
||||
)
|
||||
|
||||
|
||||
// 可在server端调试
|
||||
|
||||
func init() {
|
||||
revel.Init("dev", "github.com/leanote/leanote", "/Users/life/Documents/Go/package_base/src")
|
||||
db.Init("mongodb://localhost:27017/leanote", "leanote")
|
||||
service.InitService()
|
||||
service.ConfigS.InitGlobalConfigs()
|
||||
}
|
||||
|
||||
func TestApiFixNoteContent2(t *testing.T) {
|
||||
note2 := service.NoteS.GetNote("585df83771c1b17e8a000000", "585df81199c37b6176000004")
|
||||
note := service.NoteS.GetNoteContent("585df83771c1b17e8a000000", "585df81199c37b6176000004")
|
||||
contentFixed := service.NoteS.FixContent(note.Content, false)
|
||||
t.Log(note2.Title)
|
||||
t.Log(note.Content)
|
||||
t.Log(contentFixed)
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package tests
|
||||
|
||||
import (
|
||||
// "github.com/leanote/leanote/app/db"
|
||||
"testing"
|
||||
// . "github.com/leanote/leanote/app/lea"
|
||||
// "github.com/leanote/leanote/app/service"
|
||||
// "gopkg.in/mgo.v2"
|
||||
// "fmt"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
|
||||
// 测试登录
|
||||
func TestReg(t *testing.T) {
|
||||
a := `<a href="http://localhost:9000/api/file/getAttach?fileId=585e0e9c270a35609300000c" target="_blank" data-mce-href="http://localhost:9000/api/file/getAttach?fileId=585e0e9c270a35609300000c">proxy.go</a>`
|
||||
reg, _ := regexp.Compile(`"https*://[^/]*?/api/file/getAttach\?fileId=585e0e9c270a35609300000c`)
|
||||
|
||||
a2 := reg.ReplaceAllString(a, `"`)
|
||||
t.Log(a2)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user