diff --git a/dsSupport/Business/Preview/PreviewController/PreviewController.go b/dsSupport/Business/Preview/PreviewController/PreviewController.go index c370ee9e..b7b1a582 100644 --- a/dsSupport/Business/Preview/PreviewController/PreviewController.go +++ b/dsSupport/Business/Preview/PreviewController/PreviewController.go @@ -5,7 +5,6 @@ import ( "dsSupport/Utils/CommonUtil" "dsSupport/Utils/ObsUtil" "encoding/base64" - "fmt" "github.com/gin-gonic/gin" "log" "net/http" @@ -25,20 +24,22 @@ func Routers(r *gin.RouterGroup) { 功能:提供Office系列文件的预览功能 作者:黄海 时间:2020-07-15 - */ +*/ func previewOffice(c *gin.Context) { //本地物理路径 - uEnc :=c.Query("p") + uEnc := c.Query("p") uDec, err := base64.URLEncoding.DecodeString(uEnc) if err != nil { - log.Fatalln(err) - } - fullPath:=string(uDec) - fmt.Println(fullPath) + log.Fatalln(err) + } + fullPath := string(uDec) + //(1) 是否以http或https开头 + + //(2) 是不是本地文件 _, p := filepath.Split(fullPath) //TODO - //(1)保允许上传office系列的文件 + //(1)只允许上传office系列的文件 //(2)在上传前判断文件是否已存在,存在了直接返回,不做重复工作,也可以支持强制刷新,需要添加参数 //(3)需要判断文件名是不是是标准的GUID形式,不是的不让上传 //(4)对于异常的明显提示信息