mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-07-13 13:26:43 +02:00
Bugfixes
This commit is contained in:
@ -230,7 +230,10 @@ Future<String?> checkETagHeader(String url,
|
|||||||
StreamedResponse response = await client.send(req);
|
StreamedResponse response = await client.send(req);
|
||||||
var resHeaders = response.headers;
|
var resHeaders = response.headers;
|
||||||
client.close();
|
client.close();
|
||||||
return resHeaders[HttpHeaders.etagHeader];
|
return resHeaders[HttpHeaders.etagHeader]
|
||||||
|
?.replaceAll('"', '')
|
||||||
|
.hashCode
|
||||||
|
.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<File> downloadFile(String url, String fileName, bool fileNameHasExt,
|
Future<File> downloadFile(String url, String fileName, bool fileNameHasExt,
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'dart:typed_data';
|
||||||
|
|
||||||
import 'package:device_info_plus/device_info_plus.dart';
|
import 'package:device_info_plus/device_info_plus.dart';
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
@ -599,16 +600,19 @@ abstract class AppSource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final bytes = (await response.fold<BytesBuilder>(
|
||||||
|
BytesBuilder(), (b, d) => b..add(d)))
|
||||||
|
.toBytes();
|
||||||
|
|
||||||
final headers = <String, String>{};
|
final headers = <String, String>{};
|
||||||
response.headers.forEach((name, values) {
|
response.headers.forEach((name, values) {
|
||||||
headers[name] = values.join(', ');
|
headers[name] = values.join(', ');
|
||||||
});
|
});
|
||||||
|
|
||||||
final body = await response.transform(utf8.decoder).join();
|
|
||||||
httpClient.close();
|
httpClient.close();
|
||||||
|
|
||||||
return http.Response(
|
return http.Response.bytes(
|
||||||
body,
|
bytes,
|
||||||
response.statusCode,
|
response.statusCode,
|
||||||
headers: headers,
|
headers: headers,
|
||||||
request: http.Request(method, Uri.parse(url)),
|
request: http.Request(method, Uri.parse(url)),
|
||||||
|
Reference in New Issue
Block a user