Skip to content

微信多媒体文件没有后缀名时下载失败 #300

Closed

Description

@xiaohe27

对于用户发给企业微信的语音消息,在下载时得到的是一个没有后缀名的文件,文件名默认是“voice”。
这导致了wxCpService.mediaDownload(media_id) 这个默认的下载多媒体文件的接口抛出异常。

在ApacheMediaDownloadRequestExecutor.java
文件中

  String fileName = getFileName(response);
  if (StringUtils.isBlank(fileName)) {
    return null;
  }

  String[] nameAndExt = fileName.split("\\.");
  return FileUtils.createTmpFile(inputStream, nameAndExt[0], nameAndExt[1], super.tmpDirFile);

会抛出ArrayIndexOfBoundsException

Activity

  1. xiaohe27 commented on Aug 2, 2017

    @xiaohe27
    Author
  2. binarywang commented on Aug 2, 2017

    @binarywang
    Owner

    看起来确实是个问题,稍后修复下

  3. added a commit that references this issue on Aug 11, 2017
  4. binarywang commented on Aug 14, 2017

    @binarywang
    Owner

    临时测试版本2.7.8.BETA已修复

  5. added a commit that references this issue on Sep 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions