Diff options
Diffstat (limited to '')
| -rw-r--r-- | source/ui-atom.c | 33 |
1 file changed, 6 insertions, 27 deletions
diff --git a/source/ui-atom.c b/source/ui-atom.c index 55b59a1..b9762b1 100644 --- a/source/ui-atom.c +++ b/source/ui-atom.c @@ -105,7 +105,6 @@ static void print_entry(struct commit *commit, const char *host) { struct commitinfo *info; char *hex, *pageurl; - char delim = '&'; info = cgit_parse_commit(commit); hex = oid_to_hex(&commit->object.oid); @@ -135,15 +134,8 @@ static void print_entry(struct commit *commit, const char *host) xml_txt(feed_date(info->author_date)); html("</published>\n"); html("<link rel='alternate' type='text/html' href='"); - html(cgit_httpscheme()); - html_attr(host); - pageurl = cgit_pageurl(ctx.repo->url, "commit", NULL); - html_attr(pageurl); - // Without a virtual root the page url is already a query string, so - // the commit id continues it instead of opening one. - if (ctx.cfg.virtual_root) - delim = '?'; - html_attrf("%cid=%s", delim, hex); + pageurl = cgit_pageurl(ctx.repo->url, "commit", cgit_fmt("id=%s", hex)); + html_attrf("%s%s%s", cgit_httpscheme(), host, pageurl); html("'/>\n"); free(pageurl); html("<id>"); @@ -168,13 +160,8 @@ void cgit_print_atom(char *tip, const char *path, int max_count) int argc = 2; bool need_updated = true; - // A leading colon makes git read the path as a pathspec with magic, - // which can end the request inside git, so the feed refuses it as the - // log does. - if (path && path[0] == ':') { - cgit_print_error_page(400, "Bad Request", "Invalid path"); + if (cgit_refuse_pathspec_magic(path)) return; - } if (ctx.qry.show_all) argv[1] = "--all"; @@ -187,18 +174,10 @@ void cgit_print_atom(char *tip, const char *path, int max_count) } repo_init_revisions(the_repository, &rev, NULL); - rev.abbrev = DEFAULT_ABBREV; - rev.commit_format = CMIT_FMT_DEFAULT; - rev.verbose_header = 1; - rev.show_root_diff = 0; rev.max_count = max_count; setup_revisions(argc, argv, &rev, NULL); - // A failed setup leaves the walk holding freed commits, so it must - // not be read from. - if (prepare_revision_walk(&rev)) { - cgit_print_error_page(500, "Internal Server Error", "Unable to read the history"); + if (cgit_prepare_walk(&rev)) return; - } // CGI guarantees a server name, so only a bare test run reaches the // fallback, which keeps the mandatory feed id and links present. @@ -230,10 +209,10 @@ void cgit_print_atom(char *tip, const char *path, int max_count) html("<id>"); xml_txt(idbuf.buf); html("</id>\n"); - strbuf_release(&idbuf); html("<link rel='self' href='"); - html_attrf("%s%s%s", cgit_httpscheme(), host, fullurl); + html_attr(idbuf.buf); html("'/>\n"); + strbuf_release(&idbuf); html("<link rel='alternate' type='text/html' href='"); html_attrf("%s%s%s", cgit_httpscheme(), host, repourl); html("'/>\n"); |
