JIRA issue badge: URL protection, input examples, nits

Part of #587.
This commit is contained in:
Thaddee Tyl 2015-12-29 23:06:48 +01:00
parent a836fde7f5
commit 8ddc3cced7
2 changed files with 6 additions and 5 deletions

View File

@ -287,15 +287,16 @@ camp.notfound(/.*/, function(query, match, end, request) {
// JIRA issue integration
camp.route(/^\/jira\/issue\/(http(?:s)?)\/(.+)\/([^\/]+)\.(svg|png|gif|jpg|json)$/,
cache(function (data, match, sendBadge, request) {
var protocol = match[1];
var host = match[2];
var issueKey = match[3];
var protocol = match[1]; // eg, https
var host = match[2]; // eg, issues.apache.org/jira
var issueKey = match[3]; // eg, KAFKA-2896
var format = match[4];
var options = {
method: 'GET',
json: true,
uri: protocol + '://' + host + '/rest/api/2/issue/' + issueKey
uri: protocol + '://' + host + '/rest/api/2/issue/' +
encodeURIComponent(issueKey)
};
if (serverSecrets && serverSecrets.jira_username) {
options.auth = {

View File

@ -723,7 +723,7 @@ Pixel-perfect   Retina-ready   Fast   Consistent   Hackable
<td><code>https://img.shields.io/gitter/room/nwjs/nw.js.svg</code></td>
</tr>
<tr><th> JIRA issue: </th>
<td><img src='jira/issue/https/issues.apache.org/jira/KAFKA-2896.svg' alt=''/></td>
<td><img src='/jira/issue/https/issues.apache.org/jira/KAFKA-2896.svg' alt=''/></td>
<td><code>https://img.shields.io/jira/issue/https/issues.apache.org/jira/KAFKA-2896.svg</code></td>
</tr>
</tbody></table>