[extensions-web] Don't show diffs for images or binary files
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [extensions-web] Don't show diffs for images or binary files
- Date: Tue, 15 Nov 2011 18:51:34 +0000 (UTC)
commit cf60b9529aa1e3aa51cd83789b144b6b53756fb1
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Tue Nov 15 12:09:45 2011 -0500
Don't show diffs for images or binary files
sweettooth/review/views.py | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/sweettooth/review/views.py b/sweettooth/review/views.py
index 9b8c1c2..f3420c8 100644
--- a/sweettooth/review/views.py
+++ b/sweettooth/review/views.py
@@ -32,6 +32,8 @@ IMAGE_TYPES = {
'.svg': 'image/svg+xml',
}
+BINARY_TYPES = set(['.mo'])
+
code_formatter = pygments.formatters.HtmlFormatter(style="borland", cssclass="code")
diff_formatter = NoWrapperHtmlFormatter(style="borland")
@@ -136,11 +138,18 @@ def ajax_get_file_diff_view(request, obj):
if not can_review_extension(request.user, extension):
return HttpResponseForbidden()
- old_zipfile, new_zipfile = get_zipfiles(version)
-
filename = request.GET['filename']
highlight = request.GET.get('highlight', True)
+ file_base, file_extension = os.path.splitext(filename)
+ if file_extension in IMAGE_TYPES:
+ return
+
+ if file_extension in BINARY_TYPES:
+ return
+
+ old_zipfile, new_zipfile = get_zipfiles(version)
+
new_filelist = set(new_zipfile.namelist())
old_filelist = set(old_zipfile.namelist())
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]