fix out of range about MapArticles

This commit is contained in:
deepzz0
2017-03-02 23:07:36 +08:00
parent 7775ea35a2
commit 4f24b80107
2 changed files with 6 additions and 6 deletions

View File

@@ -119,11 +119,11 @@ func HandleArchivesPage(c *gin.Context) {
func HandleArticlePage(c *gin.Context) {
path := c.Param("slug")
artc := Ei.MapArticles[path[0:strings.Index(path, ".")]]
if artc == nil {
if !strings.HasSuffix(path, ".html") || Ei.MapArticles[path[:len(path)-5]] == nil {
HandleNotFound(c)
return
}
artc := Ei.MapArticles[path[:len(path)-5]]
h := GetBase()
h["Version"] = StaticVersion(c)
h["Title"] = artc.Title + " | " + Ei.BTitle