Skip to content
This repository was archived by the owner on Jun 8, 2023. It is now read-only.

Commit 712a884

Browse files
committed
github-commit-link: Loosen regexp to match 7-through-40-char hashes
Instead of 7-or-40-char hashes (e.g. not 8-character hashes). The {m,n} syntax is part of POSIX's basic regular expressions, although POSIX uses \{m,n\} [1]. It looks like CoffeeScript also supports this range syntax [2]: | \.{2,3} # range or splat but I couldn't find a clear regexp specification while skimming the CoffeeScript docs. [1]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_03_06 [2]: http://coffeescript.org/#regexes
1 parent 0477f1f commit 712a884

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/scripts/github-commit-link.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
module.exports = (robot) ->
3030
github = require("githubot")(robot)
31-
robot.hear /.*(\b[0-9a-f]{7}\b|\b[0-9a-f]{40}\b).*/i, (msg) ->
31+
robot.hear /.*(\b[0-9a-f]{7,40}\b).*/i, (msg) ->
3232
if process.env.HUBOT_GITHUB_REPO && process.env.HUBOT_GITHUB_TOKEN
3333
if !(msg.message.text.match(/commit\//))
3434
commit_sha = msg.match[1].replace /\b/, ""

0 commit comments

Comments
 (0)