fix: 文件路径ToSlash去除多斜杠转义
This commit is contained in:
@@ -72,13 +72,13 @@ func UploadFile(w http.ResponseWriter, r *http.Request) {
|
||||
fileName = fileNamePath
|
||||
} else {
|
||||
path = config.GetYamlConfig().OMC.FrontUpload
|
||||
fileName, err := services.HandleUploadFile(r, path, fileName)
|
||||
fileNamePath, err := services.HandleUploadFile(r, path, fileName)
|
||||
if err != nil {
|
||||
log.Error("Faile to HandleUploadFile:", err)
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
return
|
||||
}
|
||||
fileName = fileName
|
||||
fileName = fileNamePath
|
||||
}
|
||||
log.Debugf("upload file=%s to path=%s", fileName, path)
|
||||
|
||||
|
||||
@@ -220,7 +220,7 @@ func (s *CommontController) TransferStaticFile(c *gin.Context) {
|
||||
|
||||
delPrefix := strings.Replace(body.StaticPath, static["prefix"].(string), "", 1)
|
||||
staticPath := strings.Replace(delPrefix, "{language}", lang, 1)
|
||||
newFile := fmt.Sprintf("%s%s", dir, staticPath)
|
||||
newFile := filepath.ToSlash(fmt.Sprintf("%s%s", dir, staticPath))
|
||||
|
||||
err = file.CopyUploadFile(body.UploadPath, newFile)
|
||||
if err != nil {
|
||||
|
||||
@@ -461,7 +461,7 @@ func (r *NeInfoImpl) neConfOAMWirte(neType, neId string, content any, sync bool)
|
||||
|
||||
// 网元端配置路径
|
||||
neFilePath := fmt.Sprintf("/usr/local/etc/%s/%s", neTypeLower, fileName)
|
||||
neFileDir := filepath.Dir(neFilePath)
|
||||
neFileDir := filepath.ToSlash(filepath.Dir(neFilePath))
|
||||
// 修改网元文件权限
|
||||
sshClient.RunCMD(fmt.Sprintf("sudo mkdir -p %s && sudo chmod o+w %s && sudo touch %s && sudo chmod o+w %s", neFileDir, neFileDir, neFilePath, neFilePath))
|
||||
// 复制到网元进行覆盖
|
||||
|
||||
Reference in New Issue
Block a user