Browse Source

fix:修复普通用户无法下载文章附件的问题

lifei6671 7 years ago
parent
commit
6e24bbca99
1 changed files with 2 additions and 2 deletions
  1. 2 2
      controllers/BlogController.go

+ 2 - 2
controllers/BlogController.go

@@ -617,8 +617,8 @@ func (c *BlogController) Download() {
 		}
 	}
 	blogReadSession := fmt.Sprintf("blog:read:%d",blogId)
-
-	if (c.Member != nil && !c.Member.IsAdministrator()) || ( blog.BlogStatus == "password" && password != blog.Password && c.CruSession.Get(blogReadSession) == nil) {
+	//如果没有启动匿名访问,或者设置了访问密码
+	if (c.Member != nil && !c.EnableAnonymous) || ( blog.BlogStatus == "password" && password != blog.Password && c.CruSession.Get(blogReadSession) == nil) {
 		c.ShowErrorPage(403, "没有下载权限")
 	}