修复BUG

pull/51/merge
Minho 2017-06-05 13:41:47 +08:00
parent 8a4eabd158
commit 95c63fb1fb
2 changed files with 12 additions and 12 deletions

View File

@ -21,11 +21,11 @@ import (
"github.com/astaxie/beego/orm"
"github.com/boombuler/barcode"
"github.com/boombuler/barcode/qr"
"github.com/lifei6671/godoc/commands"
"github.com/lifei6671/godoc/conf"
"github.com/lifei6671/godoc/models"
"github.com/lifei6671/godoc/utils"
"github.com/lifei6671/godoc/utils/wkhtmltopdf"
"github.com/lifei6671/godoc/commands"
)
//DocumentController struct.
@ -546,7 +546,7 @@ func (c *DocumentController) DownloadAttachment() {
if attachment.BookId != book_id {
c.Abort("404")
}
c.Ctx.Output.Download(strings.Join(commands.WorkingDirectory,attachment.FilePath), attachment.FileName)
c.Ctx.Output.Download(filepath.Join(commands.WorkingDirectory, attachment.FilePath), attachment.FileName)
c.StopRun()
}
@ -587,7 +587,7 @@ func (c *DocumentController) RemoveAttachment() {
beego.Error(err)
c.JsonResult(6005, "删除失败")
}
os.Remove(strings.Join(commands.WorkingDirectory,attach.FilePath))
os.Remove(filepath.Join(commands.WorkingDirectory, attach.FilePath))
c.JsonResult(0, "ok", attach)
}

View File

@ -4,11 +4,11 @@ package models
import (
"time"
"os"
"github.com/astaxie/beego"
"github.com/astaxie/beego/orm"
"github.com/lifei6671/godoc/conf"
"os"
"github.com/astaxie/beego"
"strings"
)
// Attachment struct .