]> git.cameronkatri.com Git - cgit.git/commitdiff
allow specification of directly linked blobs mimetypes
authorMichael Krelin <hacker@klever.net>
Tue, 24 Jun 2008 21:42:32 +0000 (23:42 +0200)
committerMichael Krelin <hacker@klever.net>
Tue, 24 Jun 2008 21:42:32 +0000 (23:42 +0200)
Signed-off-by: Michael Krelin <hacker@klever.net>
cgit.c
cgit.h
ui-blob.c

diff --git a/cgit.c b/cgit.c
index ac882c34ef1ea9baa91cb874f0fb846abcf65824..0deae12d2fd04d911a0772fa2a569c73694ddb08 100644 (file)
--- a/cgit.c
+++ b/cgit.c
@@ -144,6 +144,8 @@ static void querystring_cb(const char *name, const char *value)
                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 (file)
--- a/cgit.h
+++ b/cgit.h
@@ -116,6 +116,7 @@ struct cgit_query {
        char *sha2;
        char *path;
        char *name;
+       char *mimetype;
        int   ofs;
 };
 
index dd1bbce32ded3db80bbf43564ea61e52428cfa8d..73a8c1d8e0bcf4534df5b08e9dc2e0ef848e533b 100644 (file)
--- a/ui-blob.c
+++ b/ui-blob.c
@@ -65,7 +65,7 @@ void cgit_print_blob(const char *hex, char *path, const char *head)
        }
 
        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);