File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -123,7 +123,7 @@ bitbucket_pullrequest_progress_comment() {
123
123
# $2: hash of merge commit
124
124
# $3: hash of source commit
125
125
# $4: hash of target commit
126
- build_url=" $ATC_EXTERNAL_URL /teams/$BUILD_TEAM_NAME /pipelines/$BUILD_PIPELINE_NAME /jobs/$BUILD_JOB_NAME /builds/$BUILD_NAME "
126
+ build_url=" $ATC_EXTERNAL_URL /teams/$( rawurlencode $ BUILD_TEAM_NAME) /pipelines/$( rawurlencode $ BUILD_PIPELINE_NAME) /jobs/$( rawurlencode $ BUILD_JOB_NAME) /builds/$( rawurlencode $ BUILD_NAME) "
127
127
build_status_pre=" [*Build"
128
128
build_status_post=" * **${BUILD_PIPELINE_NAME} -${BUILD_JOB_NAME} ** for $2 "
129
129
if [ " $2 " == " $3 " ]; then
Original file line number Diff line number Diff line change @@ -123,3 +123,22 @@ date_from_epoch_seconds() {
123
123
# date -r $1
124
124
date -d @$1
125
125
}
126
+
127
+ # http://stackoverflow.com/questions/296536/how-to-urlencode-data-for-curl-command
128
+ rawurlencode () {
129
+ local string=" ${1} "
130
+ local strlen=${# string}
131
+ local encoded=" "
132
+ local pos c o
133
+
134
+ for (( pos= 0 ; pos< strlen ; pos++ )) ; do
135
+ c=${string: $pos : 1}
136
+ case " $c " in
137
+ [-_.~a-zA-Z0-9] ) o=" ${c} " ;;
138
+ * ) printf -v o ' %%%02x' " '$c "
139
+ esac
140
+ encoded+=" ${o} "
141
+ done
142
+
143
+ echo " ${encoded} "
144
+ }
You can’t perform that action at this time.
0 commit comments