Vcard MMS 文件名始终为“text 1"; [英] Vcard MMS file name is always "text 1"

查看:30
本文介绍了Vcard MMS 文件名始终为“text 1";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当使用 mediaUrl 选项通过 Twilio 通过 SMS 消息发送 vcard 文件时,它会显示在 iPhone 上,文件旁边有text 1",就好像text 1"是文件名一样.

我尝试重命名 vcard 文件,使用示例 vcard 文件等.无论文件显示为文本 1".

我在 iPhone 8 和 10 上试过.我试过裸机 VCF 文件和 Outlook 中的全功能文件,甚至在线示例文件,例如

我还将文件重命名为唯一名称,并再次尝试以防 Twilio 或沿途的任何地方缓存旧文件.标题在那里,但消息在 iPhone 上仍然显示文本 1".

以防它与 Azure blob 存储有关.我还编写了一个 ASP.Net MVC 文件操作,该操作返回带有内容处理标头的文件 - 它也在 iPhone 上显示为文本 1".

解决方案

Twilio 开发人员布道者在这里.

当 Twilio 为 MMS 提供元数据时,它会根据从您提供的 URL 请求媒体时获得的 Content-Disposition 标头来提供元数据.当没有可用的时,它会被设置为通用的东西,比如在这个例子中的text 1".

要克服这个问题,您需要在您提供的文件上设置 Content-Disposition 响应标头.在此标题中,您可以声明名称和文件名.我无法对此进行测试(我不在美国,因此无法从 Twilio 接收彩信)但我猜想使用了该名称,尽管我也会使用文件名进行测试.

标题应该看起来像这样:

Content-Disposition:内联;名称=约翰·多伊";文件名=约翰-多伊.vcf"

When sending a vcard file on an SMS message via Twilio using the mediaUrl option, it shows up on the iPhone with "text 1" next to the file as if "text 1" is the file name.

I have tried renaming the vcard file, using example vcard files, etc. No matter what the files show up as "text 1".

I have tried on iPhone 8 and 10. I have tried bare bones VCF files and full featured ones from Outlook and even example ones online such as http://www.w3.org/2002/12/cal/vcard-examples/john-doe.vcf - No matter what, they show up on iPhone as "text 1".

What can I do to make this be either the phone number or a name?

Edit --- After the comment from @philnash, I was able to add a content-disposition header to the file which now comes back in the headers as follows:

 Content-Disposition: attachment; name="John Doe"; filename="john-doe.vcf" 

Here is a screenshot from Fiddler:

I also renamed the file to a unique name and tried again in case Twilio or anywhere along the way was caching the old file. The header is there but the message still shows "text 1" on the iPhone.

In case it had something to do with Azure blob storage. I also coded an ASP.Net MVC file action that returns the file with the content dispostion headers - it also shows as "text 1" on iPhone.

解决方案

Twilio developer evangelist here.

When Twilio provides the metadata for the MMS it does so based on the Content-Disposition header it gets when requesting the media from the URL you provide. When there isn't one available, it gets set to something generic, like "text 1" in this instance.

To overcome this, you need to set the Content-Disposition response header on the file you are serving. Within this header, you can declare a name and a filename. I haven't been able to test this (I'm not in the US, so can't receive the MMS from Twilio) but I would guess that the name is used, though I would test with filename too.

The header should look a bit like this:

Content-Disposition: inline; name="John Doe"; filename="john-doe.vcf"

这篇关于Vcard MMS 文件名始终为“text 1";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆