[extensions-web] Show binary filenames in the regular file view again
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [extensions-web] Show binary filenames in the regular file view again
- Date: Sat, 19 Nov 2011 21:58:19 +0000 (UTC)
commit f9d966474a6bfdb9dba86e00f1cf24b80ca56597
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Sat Nov 19 16:49:41 2011 -0500
Show binary filenames in the regular file view again
This was a bad idea. Files could sneak past reviewers who don't download
the zipfile. Don't bother with it in the diff view, though.
sweettooth/review/views.py | 15 +++++++++------
sweettooth/static/js/review.js | 1 +
2 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/sweettooth/review/views.py b/sweettooth/review/views.py
index 94133cb..f350b18 100644
--- a/sweettooth/review/views.py
+++ b/sweettooth/review/views.py
@@ -37,16 +37,17 @@ BINARY_TYPES = set(['.mo'])
code_formatter = pygments.formatters.HtmlFormatter(style="borland", cssclass="code")
diff_formatter = NoWrapperHtmlFormatter(style="borland")
-def get_filelist(zipfile):
+def get_filelist(zipfile, disallow_binary):
for name in zipfile.namelist():
if name.endswith('/'):
# There's no directory flag in the info, so I'm
# guessing this is the most reliable way to do it.
continue
- base, extension = os.path.splitext(name)
- if extension in BINARY_TYPES:
- continue
+ if disallow_binary:
+ base, extension = os.path.splitext(name)
+ if extension in BINARY_TYPES:
+ continue
yield name
@@ -140,14 +141,16 @@ def ajax_get_file_list_view(request, obj):
old_zipfile, new_zipfile = get_zipfiles(version)
- new_filelist = set(get_filelist(new_zipfile))
+ disallow_binary = request.GET['disallow_binary']
+
+ new_filelist = set(get_filelist(new_zipfile, disallow_binary))
if old_zipfile is None:
return dict(both=[],
added=sorted(new_filelist),
deleted=[])
- old_filelist = set(get_filelist(old_zipfile))
+ old_filelist = set(get_filelist(old_zipfile, disallow_binary))
both = new_filelist & old_filelist
added = new_filelist - old_filelist
diff --git a/sweettooth/static/js/review.js b/sweettooth/static/js/review.js
index e0cd89f..382cc4a 100644
--- a/sweettooth/static/js/review.js
+++ b/sweettooth/static/js/review.js
@@ -86,6 +86,7 @@ define(['jquery'], function($) {
var req = $.ajax({
type: 'GET',
dataType: 'json',
+ data: { disallow_binary: diff },
url: REVIEW_URL_BASE + '/get-file-list/' + pk,
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]