跳到主要内容

下载下来的文件名是乱码?

部分用户下载数据时,下载下来的文件名可能会是类似于15eb0387-59f2-49d2-8a28-841b1c1fe50d.xlsx这样的文件名,甚至可能连后缀名都没有。

这是因为chrome有一个chrome.downloads.onDeterminingFilename函数,可覆盖其他插件设置的文件名。

如果您安装了这类插件,将会导致社媒助手设定的文件名失效。

使用社媒助手时不要启用该插件即可!

如何找出该插件?

这类插件大多是专门进行下载数据的插件,例如AIX智能下载器

或查看启用的插件中,哪些插件拥有管理您的下载内容的权限,且拥有目标平台的访问权限,将他们逐一禁用,看是否能正常使用社媒助手。

怕麻烦就切换到别的账户或浏览器,以独立环境运行社媒助手。

当然,如果觉得乱码能接受也行!

为什么社媒助手与该类插件不可同时使用?

社媒助手不需要监听chrome.downloads.onDeterminingFilename函数,强行监听会导致其他插件的监听功能失效。

因为Chrome有规定,如果多个插件同时监听了该函数,将只会有最后一个插件的监听函数生效,其他插件的监听将无效。

Chrome原文说明如下,文档链接:https://developer.chrome.com/docs/extensions/reference/api/downloads#event-onDeterminingFilename

During the filename determination process, extensions will be given the opportunity to override the target DownloadItem.filename. Each extension may not register more than one listener for this event. Each listener must call suggest exactly once, either synchronously or asynchronously. If the listener calls suggest asynchronously, then it must return true. If the listener neither calls suggest synchronously nor returns true, then suggest will be called automatically. The DownloadItem will not complete until all listeners have called suggest. Listeners may call suggest without any arguments in order to allow the download to use downloadItem.filename for its filename, or pass a suggestion object to suggest in order to override the target filename. If more than one extension overrides the filename, then the last extension installed whose listener passes a suggestion object to suggest wins. In order to avoid confusion regarding which extension will win, users should not install extensions that may conflict. If the download is initiated by download and the target filename is known before the MIME type and tentative filename have been determined, pass filename to download instead.