fix issue can't sync images on markdown notes
This commit is contained in:
@ -166,18 +166,20 @@ func (c ApiNote) fixPostNotecontent(noteOrContent *info.ApiNote) {
|
|||||||
if file.LocalFileId != "" {
|
if file.LocalFileId != "" {
|
||||||
LogJ(file)
|
LogJ(file)
|
||||||
if !file.IsAttach {
|
if !file.IsAttach {
|
||||||
reg, _ := regexp.Compile(`"https*://[^/]*?/api/file/getImage\?fileId=`+file.LocalFileId)
|
// <img src="https://"
|
||||||
|
// 
|
||||||
|
reg, _ := regexp.Compile(`https*://[^/]*?/api/file/getImage\?fileId=`+file.LocalFileId)
|
||||||
// Log(reg)
|
// Log(reg)
|
||||||
noteOrContent.Content = reg.ReplaceAllString(noteOrContent.Content, `"/api/file/getImage?fileId=`+file.FileId)
|
noteOrContent.Content = reg.ReplaceAllString(noteOrContent.Content, `/api/file/getImage?fileId=`+file.FileId)
|
||||||
|
|
||||||
// // "http://a.com/api/file/getImage?fileId=localId" => /api/file/getImage?fileId=serverId
|
// // "http://a.com/api/file/getImage?fileId=localId" => /api/file/getImage?fileId=serverId
|
||||||
// noteOrContent.Content = strings.Replace(noteOrContent.Content,
|
// noteOrContent.Content = strings.Replace(noteOrContent.Content,
|
||||||
// baseUrl + "/api/file/getImage?fileId="+file.LocalFileId,
|
// baseUrl + "/api/file/getImage?fileId="+file.LocalFileId,
|
||||||
// "/api/file/getImage?fileId="+file.FileId, -1)
|
// "/api/file/getImage?fileId="+file.FileId, -1)
|
||||||
} else {
|
} else {
|
||||||
reg, _ := regexp.Compile(`"https*://[^/]*?/api/file/getAttach\?fileId=`+file.LocalFileId)
|
reg, _ := regexp.Compile(`https*://[^/]*?/api/file/getAttach\?fileId=`+file.LocalFileId)
|
||||||
Log(reg)
|
Log(reg)
|
||||||
noteOrContent.Content = reg.ReplaceAllString(noteOrContent.Content, `"/api/file/getAttach?fileId=`+file.FileId)
|
noteOrContent.Content = reg.ReplaceAllString(noteOrContent.Content, `/api/file/getAttach?fileId=`+file.FileId)
|
||||||
/*
|
/*
|
||||||
noteOrContent.Content = strings.Replace(noteOrContent.Content,
|
noteOrContent.Content = strings.Replace(noteOrContent.Content,
|
||||||
baseUrl + "/api/file/getAttach?fileId="+file.LocalFileId,
|
baseUrl + "/api/file/getAttach?fileId="+file.LocalFileId,
|
||||||
|
Reference in New Issue
Block a user