From e9d9cf532203cb6a35d1c4debe04c666b449d09d Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 27 Jan 2023 23:23:11 +1100 Subject: [PATCH] Handle case where streaming respone has invalid length (#250) --- assets/release_notes.md | 5 +++++ lib/api.dart | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/assets/release_notes.md b/assets/release_notes.md index 689e5879..e1aa0069 100644 --- a/assets/release_notes.md +++ b/assets/release_notes.md @@ -1,6 +1,11 @@ ## InvenTree App Release Notes --- +### 0.10.0 - February 2023 +--- + +- Bug fix for empty HttpResponse from server + ### 0.9.2 - December 2022 --- diff --git a/lib/api.dart b/lib/api.dart index 65ffbfdc..a0964416 100644 --- a/lib/api.dart +++ b/lib/api.dart @@ -117,12 +117,14 @@ class InvenTreeFileService extends FileService { } final HttpClientResponse httpResponse = await req.close(); + final http.StreamedResponse _response = http.StreamedResponse( httpResponse.timeout(Duration(seconds: 60)), httpResponse.statusCode, - contentLength: httpResponse.contentLength, + contentLength: httpResponse.contentLength < 0 ? 0 : httpResponse.contentLength, reasonPhrase: httpResponse.reasonPhrase, isRedirect: httpResponse.isRedirect, ); + return HttpGetResponse(_response); } }