Skip to content

Commit 6b6374b

Browse files
authored
Web file upload: set content type to "text/plain" incase neighter name nor url is set (#411)
This breaks the extension at the uploaded file, but otherwise the upload would fail with a server error.
1 parent 92a26dc commit 6b6374b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/src/objects/parse_file_web.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ class ParseWebFile extends ParseFileBase {
4646
}
4747

4848
final Map<String, String> headers = <String, String>{
49-
HttpHeaders.contentTypeHeader: getContentType(path.extension(url))
49+
HttpHeaders.contentTypeHeader: url ?? name != null
50+
? getContentType(path.extension(url ?? name))
51+
: 'text/plain'
5052
};
5153
try {
5254
final String uri = _client.data.serverUrl + '$_path';

0 commit comments

Comments
 (0)