Fix the path relative issue.

This commit is contained in:
zicla
2019-04-02 00:13:43 +08:00
parent 4df637172b
commit 2fb512a176
7 changed files with 132 additions and 47 deletions

View File

@ -151,7 +151,6 @@ func (this *MatterController) CreateDirectory(writer http.ResponseWriter, reques
dirPath := MakeDirAll(CONFIG.MatterPath + path)
this.logger.Info("Create Directory: %s", dirPath)
//数据库中创建文件夹。
matter := &Matter{
Puuid: puuid,
@ -162,7 +161,6 @@ func (this *MatterController) CreateDirectory(writer http.ResponseWriter, reques
}
matter = this.matterDao.Create(matter)
return this.Success(matter)
}
@ -291,7 +289,11 @@ func (this *MatterController) Upload(writer http.ResponseWriter, request *http.R
file, handler, err := request.FormFile("file")
this.PanicError(err)
defer file.Close()
defer func() {
err := file.Close()
this.PanicError(err)
}()
//对于IE浏览器filename可能包含了路径。
fileName := handler.Filename