From 520332e151fa25c50c192b752efa95fb2946e785 Mon Sep 17 00:00:00 2001 From: Marius Gedminas Date: Tue, 22 Oct 2013 10:52:43 +0300 Subject: [PATCH 1/2] Trailing newline on raw responses Without this you cannot easily share patches: user@machine1 $ git diff | curl -F 'content=<-' https://dpaste.de/api/ user@machine2 $ curl https://dpaste.de/xxxx/raw/ | git apply fatal: corrupt patch at line 67 --- dpaste/templates/dpaste/snippet_details_raw.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dpaste/templates/dpaste/snippet_details_raw.html b/dpaste/templates/dpaste/snippet_details_raw.html index 47e704a..64e47b6 100644 --- a/dpaste/templates/dpaste/snippet_details_raw.html +++ b/dpaste/templates/dpaste/snippet_details_raw.html @@ -1 +1 @@ -{{ snippet.content|safe }} \ No newline at end of file +{{ snippet.content|safe }} From 508d86ba316fd48522d73d4ae3049f96e8e73eae Mon Sep 17 00:00:00 2001 From: Marius Gedminas Date: Tue, 22 Oct 2013 10:57:20 +0300 Subject: [PATCH 2/2] Allow raw snippets without trailing slash Fixes an asymmetry where both of curl https://dpaste.de/xXxx curl https://dpaste.de/xXxx/ work, but curl https://dpaste.de/xXxx/raw/ fails without a trailing slash (because curl doesn't follow redirects by default). --- dpaste/urls/dpaste.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dpaste/urls/dpaste.py b/dpaste/urls/dpaste.py index a059325..2d1aa18 100644 --- a/dpaste/urls/dpaste.py +++ b/dpaste/urls/dpaste.py @@ -8,5 +8,5 @@ urlpatterns = patterns('dpaste.views', url(r'^(?P[a-zA-Z0-9]+)/?$', 'snippet_details', name='snippet_details'), url(r'^(?P[a-zA-Z0-9]+)/delete/$', 'snippet_delete', name='snippet_delete'), url(r'^(?P[a-zA-Z0-9]+)/gist/$', 'snippet_gist', name='snippet_gist'), - url(r'^(?P[a-zA-Z0-9]+)/raw/$', 'snippet_details', {'template_name': 'dpaste/snippet_details_raw.html', 'is_raw': True}, name='snippet_details_raw'), + url(r'^(?P[a-zA-Z0-9]+)/raw/?$', 'snippet_details', {'template_name': 'dpaste/snippet_details_raw.html', 'is_raw': True}, name='snippet_details_raw'), )