mirror of
https://github.com/git-touch/git-touch
synced 2025-02-08 15:48:41 +01:00
fix(bb): utf8 decode text
This commit is contained in:
parent
f9fa142702
commit
8f9ed5469d
@ -287,12 +287,6 @@ class AuthModel with ChangeNotifier {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String> fetchBbReadme(String p) async {
|
|
||||||
final res = await fetchBb(p);
|
|
||||||
if (res.statusCode >= 400) return null;
|
|
||||||
return res.body;
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> init() async {
|
Future<void> init() async {
|
||||||
// Listen scheme
|
// Listen scheme
|
||||||
_sub = getUriLinksStream().listen(_onSchemeDetected, onError: (err) {
|
_sub = getUriLinksStream().listen(_onSchemeDetected, onError: (err) {
|
||||||
|
@ -28,9 +28,10 @@ class BbObjectScreen extends StatelessWidget {
|
|||||||
final res = await auth
|
final res = await auth
|
||||||
.fetchBb('/repositories/$owner/$name/src/$ref/${path ?? ''}');
|
.fetchBb('/repositories/$owner/$name/src/$ref/${path ?? ''}');
|
||||||
if (res.headers[HttpHeaders.contentTypeHeader] == 'text/plain') {
|
if (res.headers[HttpHeaders.contentTypeHeader] == 'text/plain') {
|
||||||
return res.body;
|
return utf8.decode(res.bodyBytes);
|
||||||
} else {
|
} else {
|
||||||
return BbPagination.fromJson(json.decode(res.body)).values;
|
return BbPagination.fromJson(json.decode(utf8.decode(res.bodyBytes)))
|
||||||
|
.values;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actionBuilder: (p, _) {
|
actionBuilder: (p, _) {
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:filesize/filesize.dart';
|
import 'package:filesize/filesize.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:git_touch/models/auth.dart';
|
import 'package:git_touch/models/auth.dart';
|
||||||
@ -27,7 +29,8 @@ class BbRepoScreen extends StatelessWidget {
|
|||||||
final repo = BbRepo.fromJson(r);
|
final repo = BbRepo.fromJson(r);
|
||||||
final res = await auth.fetchBb(
|
final res = await auth.fetchBb(
|
||||||
'/repositories/$owner/$name/src/${repo.mainbranch.name}/README.md');
|
'/repositories/$owner/$name/src/${repo.mainbranch.name}/README.md');
|
||||||
final readme = res.statusCode >= 400 ? null : res.body;
|
final readme =
|
||||||
|
res.statusCode >= 400 ? null : utf8.decode(res.bodyBytes);
|
||||||
return Tuple2(repo, readme);
|
return Tuple2(repo, readme);
|
||||||
},
|
},
|
||||||
bodyBuilder: (t, setState) {
|
bodyBuilder: (t, setState) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user