Escapes for various elements (urls, json, slack payload, directories, commit log contents) #39
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request is concerned with escaping and encoding fixes. I've uncovered several problems, trying to set hooks for a cGit web viewer on a gitolite repository system.
's/foo\(.*\)bar/\1/g'
. any "bar" substring would get gobbed up in the group. Alternatives to make the grouping non-greedy, such as [^x]*, introduce ambiguities and negative lookaheads are difficult to maintain. This is an improved version of pull request Fix malformed payload when bundeling multiple commits #36 , Fix broken multiline commit messages and multiple commits #27 (which didn't fix the issue completely).title
andvalue
are first extracted, and then inserted into a json string. The previous shell pipeline conflated the two tasks. The resulting code is much easier to extend.sed "s/%hash%/$url/g"
produces unexpected results without escaping$url
for special sed-interpreted character commands (like '&'). For these forms, the patch provides workarounds that avoid the need to escape URLs -- but produce the same output.?id=abcabc&id2=defdef
). These query strings wreak havoc on the sed substitutions. Users shouldn't have to escape URLs in their config. Fixes issue message garbled with multiple commits in push #24.$(basename $foo)
are changed to$(basename "$foo")
.\ufffd
.curl -d
is assumed to be already encoded. the patch uses--data-urlencode
instead to ask curl to perform url encoding. This bit of the patch resolves issue Specify in documentation that Nice Names must be URL-encoded #38 and Post failed when '&' include #28.