X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/bdae1d8a8d39206ac75ab86f8e9ef53b2f29432e..3edfd83db61f5dd2f046e6e8c21dfceeae03ed82:/ui-refs.c diff --git a/ui-refs.c b/ui-refs.c index ce06b08..5bebed1 100644 --- a/ui-refs.c +++ b/ui-refs.c @@ -7,6 +7,7 @@ */ #include "cgit.h" +#include "ui-refs.h" #include "html.h" #include "ui-shared.h" @@ -103,6 +104,7 @@ static void print_tag_downloads(const struct cgit_repo *repo, const char *ref) const struct cgit_snapshot_format* f; char *filename; const char *basename; + int free_ref = 0; if (!ref || strlen(ref) < 2) return; @@ -111,8 +113,10 @@ static void print_tag_downloads(const struct cgit_repo *repo, const char *ref) if (prefixcmp(ref, basename) != 0) { if ((ref[0] == 'v' || ref[0] == 'V') && isdigit(ref[1])) ref++; - if (isdigit(ref[0])) + if (isdigit(ref[0])) { ref = xstrdup(fmt("%s-%s", basename, ref)); + free_ref = 1; + } } for (f = cgit_snapshot_formats; f->suffix; f++) { @@ -122,6 +126,9 @@ static void print_tag_downloads(const struct cgit_repo *repo, const char *ref) cgit_snapshot_link(filename, NULL, NULL, NULL, NULL, filename); html(" "); } + + if (free_ref) + free((char *)ref); } static int print_tag(struct refinfo *ref) { @@ -171,7 +178,7 @@ static int print_tag(struct refinfo *ref) static void print_refs_link(char *path) { - html("