瀏覽代碼

add filter

LinkLeong 1 年之前
父節點
當前提交
eedfdde311
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      route/v1/file.go

+ 4 - 0
route/v1/file.go

@@ -480,6 +480,10 @@ func GetFileUpload(c *gin.Context) {
 	path := c.Query("path")
 	dirPath := ""
 	hash := file.GetHashByContent([]byte(fileName))
+	if file.Exists(path + "/" + relative) {
+		c.JSON(http.StatusConflict, model.Result{Success: http.StatusConflict, Message: common_err.GetMsg(common_err.FILE_ALREADY_EXISTS)})
+		return
+	}
 	tempDir := filepath.Join(path, ".temp", hash+strconv.Itoa(totalChunks)) + "/"
 	if fileName != relative {
 		dirPath = strings.TrimSuffix(relative, fileName)