Fix/upload artifact error windows (#27802) (#27840)

This commit is contained in:
Giteabot 2023-10-30 19:57:48 +08:00 committed by GitHub
parent ac22116211
commit 3c03b7db50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -58,7 +58,8 @@ func validateArtifactHash(ctx *ArtifactContext, artifactName string) bool {
func parseArtifactItemPath(ctx *ArtifactContext) (string, string, bool) { func parseArtifactItemPath(ctx *ArtifactContext) (string, string, bool) {
// itemPath is generated from upload-artifact action // itemPath is generated from upload-artifact action
// it's formatted as {artifact_name}/{artfict_path_in_runner} // it's formatted as {artifact_name}/{artfict_path_in_runner}
itemPath := util.PathJoinRel(ctx.Req.URL.Query().Get("itemPath")) // act_runner in host mode on Windows, itemPath is joined by Windows slash '\'
itemPath := util.PathJoinRelX(ctx.Req.URL.Query().Get("itemPath"))
artifactName := strings.Split(itemPath, "/")[0] artifactName := strings.Split(itemPath, "/")[0]
artifactPath := strings.TrimPrefix(itemPath, artifactName+"/") artifactPath := strings.TrimPrefix(itemPath, artifactName+"/")
if !validateArtifactHash(ctx, artifactName) { if !validateArtifactHash(ctx, artifactName) {