Skip to content

Commit 1054568

Browse files
committed
Merge branch 'pr/461' into develop
2 parents 78271a4 + 702b353 commit 1054568

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

github3/repos/contents.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def _update_attributes(self, content):
5353

5454
# content, base64 encoded and decoded
5555
#: Base64-encoded content of the file.
56-
self.content = content.get('content', '')
56+
self.content = content.get('content')
5757

5858
#: Decoded content of the file as a bytes object. If we try to decode
5959
#: to character set for you, we might encounter an exception which
@@ -62,7 +62,7 @@ def _update_attributes(self, content):
6262
#: with the character set you wish to use, e.g.,
6363
#: ``content.decoded.decode('utf-8')``.
6464
#: .. versionchanged:: 0.5.2
65-
self.decoded = b''
65+
self.decoded = self.content
6666
if self.encoding == 'base64' and self.content:
6767
self.decoded = b64decode(self.content.encode())
6868

tests/integration/test_repos_repo.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ def test_directory_contents(self):
199199
for (filename, content) in contents:
200200
assert content.name == filename
201201
assert isinstance(content, github3.repos.contents.Contents)
202+
assert content.content is None
203+
assert content.decoded is None
202204

203205
def test_events(self):
204206
"""Test that a user can iterate over the events from a repository."""
@@ -220,6 +222,8 @@ def test_file_contents(self):
220222
contents = repository.file_contents('github3/repos/repo.py')
221223

222224
assert isinstance(contents, github3.repos.contents.Contents)
225+
assert contents.content is not None
226+
assert contents.decoded is not None
223227

224228
def test_forks(self):
225229
"""Test that a user can iterate over the forks of a repository."""

0 commit comments

Comments
 (0)