MiraiForum

    • 注册
    • 登录
    • 搜索
    • 热门
    • 最新
    • 未解决
    • 标签
    • 群组
    • 友情链接

    发送文件时不能出现字符 ":"

    开发交流
    2
    2
    234
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • lngex
      lngex 最后由 lngex 编辑

      我在Windows上运行的程序,所以在文件路径上必有 “:”,如
      C:;请问有没有什么办法解决

          /**
           * 发送视频文件
           * @param group 群
           * @param url 视频超链接
           * @return 当前消息链
           */
          public Msg video(Group group, String url) {
              File file = new File("E:\\bot\\video", System.currentTimeMillis() + ".mp4");
              // 下载文件到file
              HttpClientUtils.getFile(url,file);
              this.messageChainBuilder.append(group.getFiles().uploadNewFile(file.getPath(),ExternalResource.create(file)).toMessage());
              return this;
          }
      

      错误信息:
      java.lang.IllegalArgumentException: Chars ':*?"<>|' are not allowed in path. RemoteFile path contains illegal char: ':'. path='E:\bot\video\1657074806337.mp4'

      1 条回复 最后回复 回复 引用 0
      • Moved from BUG反馈 by  Karlatemp Karlatemp 
      • 4
        4Godsake 最后由 编辑

        uploadNewFile的方法的第一个参数是文件相对于群文件根目录/的位置

        1 条回复 最后回复 回复 引用 0
        • 1 / 1
        • First post
          Last post
        Powered by Mamoe Technologies & NodeBB | 友情链接 | 服务监控 | Contact