Skip to content

Commit 728d013

Browse files
authored
Merge pull request #192 from kevmoo/fix_it
Fix GitHubFile.text decoding
2 parents a791a32 + 54158ad commit 728d013

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## v6.0.2
2+
- Fixed `GitHubFile.text` to properly decode `content`.
3+
14
## v6.0.1
25
- Fix https://github.com/SpinlockLabs/github.dart/issues/190
36

@@ -15,6 +18,8 @@
1518
- removed deprecated items
1619
- renamed some fields with ID at the end to be Id
1720
- most model constructors now have named parameters for all properties
21+
- `GitHubFile.content` is now exactly the content returned from the JSON API
22+
without newlines removed.
1823

1924
## v5.5.0
2025

lib/src/common/model/repos_contents.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class GitHubFile {
3737
/// File Path
3838
String path;
3939

40-
/// File Content
40+
/// Base-64 encoded file content with newlines.
4141
String content;
4242

4343
/// SHA
@@ -55,10 +55,10 @@ class GitHubFile {
5555
@JsonKey(name: '_links')
5656
Links links;
5757

58-
/// Text Content
58+
/// The value in [content] Base-64 decoded.
5959
String get text {
6060
if (_text == null) {
61-
_text = utf8.decode(base64Decode(content));
61+
_text = utf8.decode(base64Decode(LineSplitter.split(content).join()));
6262
}
6363
return _text;
6464
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: github
2-
version: 6.0.1
2+
version: 6.0.2
33
author: Kenneth Endfinger <[email protected]>
44
description: A high-level GitHub API Client Library that uses Github's v3 API
55
homepage: https://github.com/SpinlockLabs/github.dart

0 commit comments

Comments
 (0)