cgit

commit 42effc939090b2fbf1b2b76cd1d9c30fabcd230e

Author: Michael Krelin <hacker@klever.net>

allow specification of directly linked blobs mimetypes

Signed-off-by: Michael Krelin <hacker@klever.net>

 cgit.c | 2 ++
 cgit.h | 1 +
 ui-blob.c | 2 +-


diff --git a/cgit.c b/cgit.c
index ac882c34ef1ea9baa91cb874f0fb846abcf65824..0deae12d2fd04d911a0772fa2a569c73694ddb08 100644
--- a/cgit.c
+++ b/cgit.c
@@ -144,6 +144,8 @@ 	} else if (!strcmp(name, "path")) {
 		ctx.qry.path = trim_end(value, '/');
 	} else if (!strcmp(name, "name")) {
 		ctx.qry.name = xstrdup(value);
+	} else if (!strcmp(name, "mimetype")) {
+		ctx.qry.mimetype = xstrdup(value);
 	}
 }
 




diff --git a/cgit.h b/cgit.h
index 4fa5cf25ed37e515824a67ec5d687d6f2085ba8e..1972d7552afd63be7d5fcbc1f3461ab4b688a971 100644
--- a/cgit.h
+++ b/cgit.h
@@ -116,6 +116,7 @@ 	char *sha1;
 	char *sha2;
 	char *path;
 	char *name;
+	char *mimetype;
 	int   ofs;
 };
 




diff --git a/ui-blob.c b/ui-blob.c
index dd1bbce32ded3db80bbf43564ea61e52428cfa8d..73a8c1d8e0bcf4534df5b08e9dc2e0ef848e533b 100644
--- a/ui-blob.c
+++ b/ui-blob.c
@@ -65,7 +65,7 @@ 		return;
 	}
 
 	buf[size] = '\0';
-	ctx.page.mimetype = NULL;
+	ctx.page.mimetype = ctx.qry.mimetype;
 	ctx.page.filename = path;
 	cgit_print_http_headers(&ctx);
 	write(htmlfd, buf, size);