2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-04-28 05:26:47 +00:00

Handle case where streaming respone has invalid length (#250)

This commit is contained in:
Oliver 2023-01-27 23:23:11 +11:00 committed by GitHub
parent 20de6e03e6
commit e9d9cf5322
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -1,6 +1,11 @@
## InvenTree App Release Notes ## InvenTree App Release Notes
--- ---
### 0.10.0 - February 2023
---
- Bug fix for empty HttpResponse from server
### 0.9.2 - December 2022 ### 0.9.2 - December 2022
--- ---

View File

@ -117,12 +117,14 @@ class InvenTreeFileService extends FileService {
} }
final HttpClientResponse httpResponse = await req.close(); final HttpClientResponse httpResponse = await req.close();
final http.StreamedResponse _response = http.StreamedResponse( final http.StreamedResponse _response = http.StreamedResponse(
httpResponse.timeout(Duration(seconds: 60)), httpResponse.statusCode, httpResponse.timeout(Duration(seconds: 60)), httpResponse.statusCode,
contentLength: httpResponse.contentLength, contentLength: httpResponse.contentLength < 0 ? 0 : httpResponse.contentLength,
reasonPhrase: httpResponse.reasonPhrase, reasonPhrase: httpResponse.reasonPhrase,
isRedirect: httpResponse.isRedirect, isRedirect: httpResponse.isRedirect,
); );
return HttpGetResponse(_response); return HttpGetResponse(_response);
} }
} }