bdfacbcf700e default tip

Friendlier patch urls & mimetype

Replace /changeset/<revset>/patch/ by /changeset/<revset>.patch and set
the mimetype to text/x-diff.

This helps the browser opening the right application thanks to the
mimetype, and the application to better guess the file type thanks
to the '.patch' extension
[view raw] [browse files]
author Christophe de Vienne <christophe@cdevienne.info>
date Fri, 19 Aug 2016 18:58:14 +0200
parents acf857ef0abe
children (none)
branches/tags default tip
files review/templates/changeset.html review/web.py

Changes

--- a/review/templates/changeset.html	Fri Dec 12 11:17:43 2014 +0100
+++ b/review/templates/changeset.html	Fri Aug 19 18:58:14 2016 +0200
@@ -25,7 +25,7 @@
 {% block content %}
     <div class="group head">
         <div class="committer-avatar" style="background: transparent url('{{ utils['cset_gravatar'](rev, 60) }}') top left no-repeat">&nbsp;</div>
-        <div class="patch"><a href="/changeset/{{ utils['node_short'](rev.node()) }}/patch/">Download Patch &darr;</a></div>
+        <div class="patch"><a href="/changeset/{{ utils['node_short'](rev.node()) }}.patch">Download Patch &darr;</a></div>
 
         <h2>
             {{ rev.rev() }}:
--- a/review/web.py	Fri Dec 12 11:17:43 2014 +0100
+++ b/review/web.py	Fri Aug 19 18:58:14 2016 +0200
@@ -213,7 +213,7 @@
         newer=newer, older=older)
 
 
-@app.route('/changeset/<revhash>/patch/')
+@app.route('/changeset/<revhash>.patch')
 def patch(revhash):
     result = StringIO.StringIO()
     try:
@@ -224,7 +224,7 @@
         abort(404)
     except UnicodeEncodeError:
         abort(404)
-    return Response(result.getvalue(), content_type="application/octet-stream")
+    return Response(result.getvalue(), content_type="text/x-patch")
 
 @app.route('/pull/', methods=['POST'])
 def pull():