This commit is contained in:
2023-03-09 14:58:06 +08:00
parent d1b722176d
commit 73ad8f5202
+2 -2
View File
@@ -30,7 +30,7 @@ type Article struct {
}
func (a *Article) GetArticleById(id string) (*Article, error) {
path := os.Getenv("ARTICLE_PATH") + strings.Replace(id, "-", "/", -1) + ".md"
path := os.Getenv("ARTICLE_PATH") + strings.Replace(id, "<-", "/", -1) + ".md"
return a.GetArticleByPath(path)
}
@@ -41,7 +41,7 @@ func (a *Article) GetArticleByPath(path string) (*Article, error) {
a.Id = a.Uri[:len(a.Uri)-len(filepath.Ext(a.Uri))]
a.Id = strings.Replace(a.Id, "\\", "/", -1)
a.Id = strings.Replace(a.Id, "/", "-", -1)
a.Id = strings.Replace(a.Id, "/", "<-", -1)
// 读取文件内容
fileByte, err := ioutil.ReadFile(a.Path)