author | Lars Hjemli <hjemli@gmail.com> | 2007-06-16 19:35:58 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2007-06-16 19:35:58 (UTC) |
commit | f91b9696a36008c245a3195800ba0c5fa3e890f9 (patch) (unidiff) | |
tree | c064e555881d3b426b73fd841531a19c064a9984 | |
parent | ffc69736a606fd8f9a10468cce48b9a37b428944 (diff) | |
download | cgit-f91b9696a36008c245a3195800ba0c5fa3e890f9.zip cgit-f91b9696a36008c245a3195800ba0c5fa3e890f9.tar.gz cgit-f91b9696a36008c245a3195800ba0c5fa3e890f9.tar.bz2 |
ui-tree: make blob viewer generate valid html
A leftover '</td></tr>' made ui-tree generate invalid html for blob
content. Fix it.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | ui-tree.c | 1 |
1 files changed, 0 insertions, 1 deletions
@@ -26,49 +26,48 @@ static void print_object(const unsigned char *sha1, char *path) | |||
26 | } | 26 | } |
27 | 27 | ||
28 | buf = read_sha1_file(sha1, &type, &size); | 28 | buf = read_sha1_file(sha1, &type, &size); |
29 | if (!buf) { | 29 | if (!buf) { |
30 | cgit_print_error(fmt("Error reading object %s", | 30 | cgit_print_error(fmt("Error reading object %s", |
31 | sha1_to_hex(sha1))); | 31 | sha1_to_hex(sha1))); |
32 | return; | 32 | return; |
33 | } | 33 | } |
34 | 34 | ||
35 | html("<table class='blob'>\n"); | 35 | html("<table class='blob'>\n"); |
36 | idx = 0; | 36 | idx = 0; |
37 | start = 0; | 37 | start = 0; |
38 | lineno = 0; | 38 | lineno = 0; |
39 | while(idx < size) { | 39 | while(idx < size) { |
40 | if (buf[idx] == '\n') { | 40 | if (buf[idx] == '\n') { |
41 | buf[idx] = '\0'; | 41 | buf[idx] = '\0'; |
42 | htmlf("<tr><td class='no'>%d</td><td class='txt'>", | 42 | htmlf("<tr><td class='no'>%d</td><td class='txt'>", |
43 | ++lineno); | 43 | ++lineno); |
44 | html_txt(buf + start); | 44 | html_txt(buf + start); |
45 | html("</td></tr>\n"); | 45 | html("</td></tr>\n"); |
46 | start = idx + 1; | 46 | start = idx + 1; |
47 | } | 47 | } |
48 | idx++; | 48 | idx++; |
49 | } | 49 | } |
50 | html("\n</td></tr>\n"); | ||
51 | html("</table>\n"); | 50 | html("</table>\n"); |
52 | } | 51 | } |
53 | 52 | ||
54 | 53 | ||
55 | static int ls_item(const unsigned char *sha1, const char *base, int baselen, | 54 | static int ls_item(const unsigned char *sha1, const char *base, int baselen, |
56 | const char *pathname, unsigned int mode, int stage) | 55 | const char *pathname, unsigned int mode, int stage) |
57 | { | 56 | { |
58 | char *name; | 57 | char *name; |
59 | enum object_type type; | 58 | enum object_type type; |
60 | unsigned long size = 0; | 59 | unsigned long size = 0; |
61 | char *url, *qry; | 60 | char *url, *qry; |
62 | 61 | ||
63 | name = xstrdup(pathname); | 62 | name = xstrdup(pathname); |
64 | type = sha1_object_info(sha1, &size); | 63 | type = sha1_object_info(sha1, &size); |
65 | if (type == OBJ_BAD && !S_ISDIRLNK(mode)) { | 64 | if (type == OBJ_BAD && !S_ISDIRLNK(mode)) { |
66 | htmlf("<tr><td colspan='3'>Bad object: %s %s</td></tr>", | 65 | htmlf("<tr><td colspan='3'>Bad object: %s %s</td></tr>", |
67 | name, | 66 | name, |
68 | sha1_to_hex(sha1)); | 67 | sha1_to_hex(sha1)); |
69 | return 0; | 68 | return 0; |
70 | } | 69 | } |
71 | qry = fmt("h=%s&path=%s%s%s", curr_rev, | 70 | qry = fmt("h=%s&path=%s%s%s", curr_rev, |
72 | cgit_query_path ? cgit_query_path : "", | 71 | cgit_query_path ? cgit_query_path : "", |
73 | cgit_query_path ? "/" : "", pathname); | 72 | cgit_query_path ? "/" : "", pathname); |
74 | url = cgit_pageurl(cgit_query_repo, "tree", qry); | 73 | url = cgit_pageurl(cgit_query_repo, "tree", qry); |