diff --git a/coreapi/friendlist.c b/coreapi/friendlist.c index 249bae980..6f196721e 100644 --- a/coreapi/friendlist.c +++ b/coreapi/friendlist.c @@ -962,7 +962,7 @@ void linphone_friend_list_notify_presence_received(LinphoneFriendList *list, Lin const char *subtype = linphone_content_get_subtype(body); if ((strcmp(type, "multipart") != 0) || (strcmp(subtype, "related") != 0)) { - ms_warning("multipart presence notified but it is not 'multipart/related'"); + ms_warning("multipart presence notified but it is not 'multipart/related', instead is '%s/%s'", type, subtype); return; } diff --git a/src/chat/chat-message/chat-message.cpp b/src/chat/chat-message/chat-message.cpp index 407a9e734..26232bbeb 100644 --- a/src/chat/chat-message/chat-message.cpp +++ b/src/chat/chat-message/chat-message.cpp @@ -741,7 +741,7 @@ void ChatMessagePrivate::send () { auto msgOp = dynamic_cast(op); if (!externalBodyUrl.empty()) { - char *content_type = ms_strdup_printf("message/external-body; access-type=URL; URL=\"%s\"", externalBodyUrl.c_str()); + char *content_type = ms_strdup_printf("message/external-body;access-type=URL;URL=\"%s\"", externalBodyUrl.c_str()); msgOp->send_message(content_type, NULL); ms_free(content_type); } else if (internalContent.getContentType().isValid()) { diff --git a/src/content/content-type.cpp b/src/content/content-type.cpp index 5bb264db6..8da1a08a4 100644 --- a/src/content/content-type.cpp +++ b/src/content/content-type.cpp @@ -80,7 +80,7 @@ ContentType::ContentType (const string &contentType) : Header(*new ContentTypePr token = params.substr(0, posParam); } addParameter(HeaderParam(token)); - params.erase(0, pos + 1); + params.erase(0, posParam + 1); } while (posParam != std::string::npos); } } @@ -131,8 +131,7 @@ ContentType &ContentType::operator= (const ContentType &other) { bool ContentType::operator== (const ContentType &other) const { return getType() == other.getType() && - getSubType() == other.getSubType() && - getParameters() == other.getParameters(); + getSubType() == other.getSubType(); } bool ContentType::operator!= (const ContentType &other) const { diff --git a/tester/content-manager-tester.cpp b/tester/content-manager-tester.cpp index de371dfb4..9509b5442 100644 --- a/tester/content-manager-tester.cpp +++ b/tester/content-manager-tester.cpp @@ -352,9 +352,18 @@ void list_to_multipart () { BC_ASSERT_TRUE(originalStr == generatedStr); } +static void content_type_parsing(void) { + const string type = "message/external-body;access-type=URL;URL=\"https://www.linphone.org/img/linphone-open-source-voip-projectX2.png\""; + ContentType contentType = ContentType(type); + BC_ASSERT_STRING_EQUAL("message", contentType.getType().c_str()); + BC_ASSERT_STRING_EQUAL("external-body", contentType.getSubType().c_str()); + BC_ASSERT_TRUE(type == contentType.asString()); +} + test_t content_manager_tests[] = { TEST_NO_TAG("Multipart to list", multipart_to_list), - TEST_NO_TAG("List to multipart", list_to_multipart) + TEST_NO_TAG("List to multipart", list_to_multipart), + TEST_NO_TAG("Content type parsing", content_type_parsing) }; test_suite_t content_manager_test_suite = {