diff options
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Gate a readme ending in a colon like a disk path
trust-scan-config passed any readme holding a colon as a tracked file, while the parser takes one only when a path follows the colon, so a scanned repository could still name a file on disk outside itself. The two now share one test.
Diffstat (limited to '')
-rw-r--r--source/cgit.c6
1 file changed, 2 insertions, 4 deletions
diff --git a/source/cgit.c b/source/cgit.c
index 633b011..82c496e 100644
--- a/source/cgit.c
+++ b/source/cgit.c
@@ -1035,10 +1035,8 @@ static void parse_readme(const char *readme, char **filename, char **ref, struct
if (!readme || !readme[0])
return;
- // A colon separates a ref from a path, so a setting carrying one names
- // a file tracked in the repository rather than one on disk.
- colon = strchr(readme, ':');
- if (colon && strlen(colon) > 1) {
+ if (cgit_readme_is_tracked(readme)) {
+ colon = strchr(readme, ':');
if (colon == readme && ctx.qry.head)
*ref = xstrdup(ctx.qry.head);
else if (colon == readme && repo->defbranch)