Don't throw error if it is not a draft

Former-commit-id: fb33f600de938ad16ac1c2f1ab6aaae30f5598a8 [formerly c98a595f1f9adb3fc9f792ef353fd09f2a93674d] [formerly bb7623d54853a8df0525313aafcf076c3114af26 [formerly 8a4e1b6520]]
Former-commit-id: 49ef204abe70d7b791260f589b9569a94c4cdca9 [formerly 9499193985f3b9d91a0e6fe25a028937df7e919b]
Former-commit-id: 7fdb34a388e878accf14ae24a7a53714c62eda06
This commit is contained in:
Henrique Dias 2017-07-27 13:30:46 +01:00
parent 73d74394c8
commit fc4c6ec246

View File

@ -110,7 +110,7 @@ func (h hugo) BeforeAPI(c *filemanager.RequestContext, w http.ResponseWriter, r
// We only run undraft command if it is a file.
if !strings.HasSuffix(filename, "/") {
args := []string{"undraft", filename}
if err := Run(h.Exe, args, h.Root); err != nil {
if err := Run(h.Exe, args, h.Root); err != nil && !strings.Contains(err.Error(), "not a Draft") {
return http.StatusInternalServerError, err
}
}