[PATCH 3 of 4] Fix raw files in the web UI

Eric Hopper hopper at omnifarious.org
Thu Jun 29 21:14:58 CDT 2006


# HG changeset patch
# User Eric Hopper <hopper at omnifarious.org>
# Node ID d5a3cc6520d550fe9e96f9f3ac9da9a63008260f
# Parent  589474a1dc3637f6f16a8da9f7dad8cdd9cd6f7f
Fix raw files in the web UI.

diff -r 589474a1dc36 -r d5a3cc6520d5 mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py	Thu Jun 29 18:31:17 2006 -0700
+++ b/mercurial/hgweb/hgweb_mod.py	Thu Jun 29 18:34:26 2006 -0700
@@ -657,6 +657,12 @@ class hgweb(object):
             req.header(msg.items())
             yield header_file.read()
 
+        def rawfileheader(**map):
+            req.header([('Content-type', map['mimetype']),
+                        ('Content-disposition', 'filename=%s' % map['file']),
+                        ('Content-length', str(len(map['raw'])))])
+            yield ''
+
         def footer(**map):
             yield self.t("footer",
                          motd=self.repo.ui.config("web", "motd", ""),
@@ -714,6 +720,7 @@ class hgweb(object):
                                                "repo": self.reponame,
                                                "header": header,
                                                "footer": footer,
+                                               "rawfileheader": rawfileheader,
                                                })
 
         if not req.form.has_key('cmd'):
diff -r 589474a1dc36 -r d5a3cc6520d5 templates/map-raw
--- a/templates/map-raw	Thu Jun 29 18:31:17 2006 -0700
+++ b/templates/map-raw	Thu Jun 29 18:34:26 2006 -0700
@@ -8,7 +8,7 @@ changesetparent = '# parent: #node#'
 changesetparent = '# parent: #node#'
 changesetchild = '# child: #node#'
 filenodelink = ''
-filerevision = 'Content-Type: #mimetype#\nContent-Disposition: filename=#file#\n\n#raw#'
+filerevision = '#rawfileheader##raw#'
 fileline = '#line#'
 diffblock = '#lines#'
 filediff = filediff-raw.tmpl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.selenic.com/pipermail/mercurial/attachments/20060629/30082e93/attachment.pgp


More information about the Mercurial mailing list