commit b27da80170166a2622d2abce31dcd388edc14ae7 from: Tracey Emery date: Wed Jan 29 17:48:56 2020 UTC remove html from blob output commit - e46f587ca8c2affae88104d037a368b3802c7492 commit + b27da80170166a2622d2abce31dcd388edc14ae7 blob - 12819268eddbfa9b3a5d68d8897c937bb20f7cd4 blob + e434f320ca8e2088d4602607b2dbedbac69c4188 --- gotweb/files/cgi-bin/gw_tmpl/blob.tmpl +++ gotweb/files/cgi-bin/gw_tmpl/blob.tmpl @@ -1,22 +1 @@ - - - - @@title@@ - @@head@@ - - -
- -
- @@sitepath@@ - @@search@@ -
-
- @@content@@ -
- @@siteowner@@ -
- - +@@content@@ blob - f1c85a76870b084cc23a41e2f8e21c246ffb73e2 blob + b66073829cad40097e9acd307d2e9e14b6c34b9d --- gotweb/gotweb.c +++ gotweb/gotweb.c @@ -367,7 +367,7 @@ gw_blob(struct gw_trans *gw_trans) { const struct got_error *error = NULL; struct gw_header *header = NULL; - char *blob = NULL, *blob_html = NULL, *blob_html_disp = NULL; + char *blob = NULL; enum kcgi_err kerr; if (pledge("stdio rpath wpath cpath proc exec sendfd unveil", @@ -385,37 +385,22 @@ gw_blob(struct gw_trans *gw_trans) if (error) goto done; - blob_html = gw_get_file_blame_blob(gw_trans); + blob = gw_get_file_blame_blob(gw_trans); - if (blob_html == NULL) { - blob_html = strdup(""); - if (blob_html == NULL) { + if (blob == NULL) { + blob = strdup(""); + if (blob == NULL) { error = got_error_from_errno("strdup"); goto done; } } - if (asprintf(&blob_html_disp, blob_header, - gw_gen_age_header(gw_get_time_str(header->committer_time, TM_LONG)), - gw_gen_commit_msg_header(gw_html_escape(header->commit_msg)), - blob_html) == -1) { - error = got_error_from_errno("asprintf"); - goto done; - } - - if (asprintf(&blob, blob_wrapper, blob_html_disp) == -1) { - error = got_error_from_errno("asprintf"); - goto done; - } - kerr = khttp_puts(gw_trans->gw_req, blob); if (kerr != KCGI_OK) error = gw_kcgi_error(kerr); done: got_ref_list_free(&header->refs); gw_free_headers(header); - free(blob_html_disp); - free(blob_html); free(blob); return error; } @@ -1194,8 +1179,8 @@ gw_parse_querystring(struct gw_trans *gw_trans) if ((p = gw_trans->gw_req->fieldmap[KEY_PAGE])) gw_trans->page = p->parsed.i; - /* if (gw_trans->action == GW_RAW) */ - /* gw_trans->mime = KMIME_TEXT_PLAIN; */ + if (gw_trans->action == GW_BLOB) + gw_trans->mime = KMIME_TEXT_PLAIN; return error; } blob - 47c732d635c1ea51ab78f5f2dfcce303770ce0a7 blob + fb264cc340fe1da8a037a5eb8ad6c1f3dd3a394c --- gotweb/gotweb_ui.h +++ gotweb/gotweb_ui.h @@ -207,31 +207,7 @@ char *briefs_navs = "diff | " \ "tree"; - -/* blob.tmpl */ - -char *blob_wrapper = - "
" \ - "
Blob
" \ - "
%s
"; - -char *blob_header = - "
" \ - "
%s%s
" \ - "
" \ - "
" \ - "
%s
" \ - ""; -char *blob_line = - "
" \ - "
%.*d
" \ - "
%.8s
" \ - "
%s
" \ - "
%-8s
" \ - "
%s
" \ - "
"; - /* blame.tmpl */ char *blame_wrapper =