Skip to content

Commit 964b515

Browse files
committed
(autorelease) fix: escape double quotes in payload
1 parent 40fb7f5 commit 964b515

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

.woodpecker/buildSlackNotify.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/bin/sh
22

3-
set -x
43

54
COMMIT_SHORT_SHA=$(echo $CI_COMMIT_SHA | cut -c1-8)
65

@@ -23,6 +22,8 @@ if [ "$CI_STEP_STATUS" = "success" ]; then
2322
fi
2423
export BUILD_LOG=$(cat ./build.log)
2524

25+
## escape double quotes in the build log
26+
BUILD_LOG=$(echo $BUILD_LOG | sed 's/"/\\"/g')
2627

2728
MESSAGE="Broke \`$CI_REPO_NAME/$CI_COMMIT_BRANCH\` with commit _${CI_COMMIT_MESSAGE}_ (<$CI_COMMIT_URL|$COMMIT_SHORT_SHA>)"
2829
CODE_BLOCK="\`\`\`$BUILD_LOG\n\`\`\`"
@@ -40,4 +41,4 @@ curl -sS -X POST -H "Content-Type: application/json" -d '{
4041
"pretext": "'"$MESSAGE"'"
4142
}
4243
]
43-
}' "$DEVELOPERS_SLACK_WEBHOOK"
44+
}' "$DEVELOPERS_SLACK_WEBHOOK" 2>&1

0 commit comments

Comments
 (0)