From 186b6c61bfe85afa4d6bf213d04a28dd2853fed2 Mon Sep 17 00:00:00 2001 From: Denis Cornehl Date: Tue, 5 Jan 2016 08:09:10 +0100 Subject: Fixed #26024 -- Fixed regression in ConditionalGetMiddleware ETag support. Thanks Denis Cornehl for help with the patch. --- django/utils/http.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'django/utils') diff --git a/django/utils/http.py b/django/utils/http.py index 3a3f665443..2dce7d3add 100644 --- a/django/utils/http.py +++ b/django/utils/http.py @@ -253,6 +253,13 @@ def quote_etag(etag): return '"%s"' % etag.replace('\\', '\\\\').replace('"', '\\"') +def unquote_etag(etag): + """ + Unquote an ETag string; i.e. revert quote_etag(). + """ + return etag.strip('"').replace('\\"', '"').replace('\\\\', '\\') if etag else etag + + def is_same_domain(host, pattern): """ Return ``True`` if the host is either an exact match or a match -- cgit v1.3