diff options
Diffstat (limited to 'source/ui-plain.c')
| -rw-r--r-- | source/ui-plain.c | 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 6 insertions, 4 deletions
diff --git a/source/ui-plain.c b/source/ui-plain.c index e58849c..8085382 100644 --- a/source/ui-plain.c +++ b/source/ui-plain.c @@ -44,7 +44,7 @@ static int print_object(const struct object_id *oid, const char *path) return 1; } - mimetype = get_mimetype_for_filename(path); + mimetype = cgit_get_mimetype_for_filename(path); ctx.page.mimetype = mimetype; if (!ctx.repo->enable_html_serving) { @@ -78,9 +78,9 @@ static int print_object(const struct object_id *oid, const char *path) static char *buildpath(const char *base, int baselen, const char *path) { if (path[0]) - return fmtalloc("%.*s%s/", baselen, base, path); + return cgit_fmtalloc("%.*s%s/", baselen, base, path); else - return fmtalloc("%.*s/", baselen, base); + return cgit_fmtalloc("%.*s/", baselen, base); } static void print_dir(const struct object_id *oid, const char *base, @@ -144,7 +144,9 @@ static int walk_tree(const struct object_id *oid, struct strbuf *base, { struct walk_tree_context *walk_tree_ctx = cbdata; - if (base->len == walk_tree_ctx->match_baselen) { + // match_baselen is -1 when no path was given, which no length equals. + if (walk_tree_ctx->match_baselen >= 0 && + base->len == (size_t)walk_tree_ctx->match_baselen) { if (S_ISREG(mode) || S_ISLNK(mode)) { if (print_object(oid, pathname)) walk_tree_ctx->match = 1; |
