@@ -303,13 +303,14 @@ module SGXbwmsgsv2
body = s.respond_to?(:body) ? s.body : ''
EM::HttpRequest.new(un.text, tls: { verify_peer: true }).head.then { |http|
+ # If content is too large, or MIME type is not supported, place the link inside the body and do not send MMS.
if http.response_header["CONTENT_LENGTH"].to_i > 3500000 ||
!MMS_MIME_TYPES.include?(http.response_header["CONTENT_TYPE"])
unless body.include?(un.text)
s.body = body.empty? ? un.text : "#{body}\n#{un.text}"
end
to_catapult(s, nil, num_dest, user_id, token, secret, usern)
- else
+ else # If size is less than ~3.5MB, strip the link from the body and attach media in the body.
# some clients send URI in both body & <url/> so delete
s.body = body.sub(/\s*#{Regexp.escape(un.text)}\s*$/, '')