🧑‍💻 Fix API /api/asset/upload response body succMap field (#12361)

* 🐛 Fix API `/api/asset/upload` response body `succMap` field

* 🐛 Fix #12255
This commit is contained in:
Yingyi / 颖逸 2024-08-30 09:43:16 +08:00 committed by GitHub
parent 6a3095c56c
commit b924452eab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View file

@ -126,7 +126,7 @@ export class Options {
url: Constants.UPLOAD_ADDRESS, url: Constants.UPLOAD_ADDRESS,
extraData: {}, extraData: {},
fieldName: "file[]", fieldName: "file[]",
filename: (name: string) => name.replace(/[\\/:*?"'<>|]/g, ""), filename: (name: string) => name.replace(/[\\/:*?"'<>|\[\]\(\)~!`&{}=#%$]/g, ""),
linkToImgUrl: "", linkToImgUrl: "",
withCredentials: false, withCredentials: false,
} }

View file

@ -100,7 +100,7 @@ func InsertLocalAssets(id string, assetPaths []string, isUpload bool) (succMap m
return return
} }
f.Close() f.Close()
succMap[fName] = "assets/" + fName succMap[baseName] = "assets/" + fName
} }
} }
IncSync() IncSync()
@ -284,7 +284,7 @@ func Upload(c *gin.Context) {
os.RemoveAll(tmpDir2) os.RemoveAll(tmpDir2)
} }
succMap[fName] = strings.TrimPrefix(path.Join(relAssetsDirPath, fName), "/") succMap[baseName] = strings.TrimPrefix(path.Join(relAssetsDirPath, fName), "/")
} }
} }