From 1f1193f2ba514d3258d7bc00f21f7cd2e09037d3 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jul 11 2015 08:42:22 +0000 Subject: Rely on both pygit2 and our own method to find out if a file is a binary --- diff --git a/pagure/ui/repo.py b/pagure/ui/repo.py index c447382..aecdaf2 100644 --- a/pagure/ui/repo.py +++ b/pagure/ui/repo.py @@ -1300,9 +1300,9 @@ def edit_file(repo, branchname, filename, username=None): repo_obj, commit.tree, filename.split('/')) if not content or isinstance(content, pygit2.Tree): flask.abort(404, 'File not found') - if content.is_binary: - flask.abort(400, 'Cannot edit binary files') data = repo_obj[content.oid].data + if content.is_binary or pagure.lib.is_binary(data): + flask.abort(400, 'Cannot edit binary files') else: data = form.content.data