[geary] Fix ContentTypeTest.guess_type_from_buf occasionally failing.
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary] Fix ContentTypeTest.guess_type_from_buf occasionally failing.
- Date: Thu, 3 May 2018 17:49:09 +0000 (UTC)
commit 01a43bbe070ef9ab3b9590d8f66d5ebcdfc7facc
Author: Michael James Gratton <mike vee net>
Date: Thu May 3 17:01:18 2018 +1000
Fix ContentTypeTest.guess_type_from_buf occasionally failing.
src/engine/mime/mime-content-type.vala | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/engine/mime/mime-content-type.vala b/src/engine/mime/mime-content-type.vala
index 59d530b..8f12e55 100644
--- a/src/engine/mime/mime-content-type.vala
+++ b/src/engine/mime/mime-content-type.vala
@@ -79,9 +79,9 @@ public class Geary.Mime.ContentType : Geary.BaseObject {
int max_len = 4096;
// XXX determine actual max needed buffer size using
// xdg_mime_get_max_buffer_extents?
- uint8[] data = (max_len > buf.size)
- ? buf.get_bytes()[0:max_len - 1].get_data()
- : buf.get_uint8_array();
+ uint8[] data = (buf.size <= max_len)
+ ? buf.get_uint8_array()
+ : buf.get_bytes()[0:max_len].get_data();
// XXX might just want to use xdgmime lib directly here to
// avoid the intermediate glib_content_type step here?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]