1
1
mirror of https://github.com/go-gitea/gitea synced 2024-11-13 21:54:24 +00:00
gitea/modules/markdown
Roy Marples 89845f6728 Fix SHA1 hash linking (#2143)
This changes the regex to look for a hash from 7 to 40 characters,
to match the use of abbreviated hash lookups in both git and github.
The restriction of not being a pure number is also removed because
1234567 is now considered a valid abbreviated hash, as is deadbeef.

A note has been added to the top of the code to state that the
literal regex match is fine, but no extra validation is currently
performed so some false positives are expected.

A future change could ensure that the hash exists in the repository
before rendering it as a link, although this might incur a slight
performance penalty.

Reverts part of commit 4a46613 and fixes #2053.
2017-07-12 04:26:54 +02:00
..
markdown_test.go Fix SHA1 hash linking (#2143) 2017-07-12 04:26:54 +02:00
markdown.go Fix SHA1 hash linking (#2143) 2017-07-12 04:26:54 +02:00
sanitizer_test.go Sanitation fix from Gogs (#1461) 2017-04-13 10:52:24 +08:00
sanitizer.go fix #1501 ssh hangs caused by #1461 (#1513) 2017-04-19 19:16:36 +08:00