Check content_length for null before parsing in http HEAD message response
fixes #468
This commit is contained in:
parent
542744ade2
commit
680d28360c
|
@ -89,9 +89,11 @@ public class FileProvider : Dino.FileProvider, Object {
|
||||||
if (name == "Content-Length") content_length = val;
|
if (name == "Content-Length") content_length = val;
|
||||||
});
|
});
|
||||||
file_transfer.mime_type = content_type;
|
file_transfer.mime_type = content_type;
|
||||||
|
if (content_length != null) {
|
||||||
file_transfer.size = int.parse(content_length);
|
file_transfer.size = int.parse(content_length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async void download(FileTransfer file_transfer, File file_) {
|
public async void download(FileTransfer file_transfer, File file_) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -91,7 +91,9 @@ public class FileProvider : Dino.FileProvider, Object {
|
||||||
if (name == "Content-Length") content_length = val;
|
if (name == "Content-Length") content_length = val;
|
||||||
});
|
});
|
||||||
file_transfer.mime_type = content_type;
|
file_transfer.mime_type = content_type;
|
||||||
|
if (content_length != null) {
|
||||||
file_transfer.size = int.parse(content_length);
|
file_transfer.size = int.parse(content_length);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
warning("HTTP HEAD download status code " + head_message.status_code.to_string());
|
warning("HTTP HEAD download status code " + head_message.status_code.to_string());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue