# HG changeset patch # User Eric Hopper # Date 2006-06-30 01:34:26 # Node ID d5a3cc6520d550fe9e96f9f3ac9da9a63008260f # Parent 589474a1dc3637f6f16a8da9f7dad8cdd9cd6f7f Fix raw files in the web UI. diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py --- a/mercurial/hgweb/hgweb_mod.py +++ b/mercurial/hgweb/hgweb_mod.py @@ -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 --git a/templates/map-raw b/templates/map-raw --- a/templates/map-raw +++ b/templates/map-raw @@ -8,7 +8,7 @@ diffline = '#line#' 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