Skip to content

文件上传功能对于pdf文件编码错误 #311

@alexmaehon

Description

@alexmaehon

注: 对于PyWebIO使用咨询或对于其他人也可能有帮助的问题,请考虑移至 Discussions 进行发帖。

BUG描述

file = file_upload(label = 'xxx',
accept=['.pdf'],
max_size='100M',
multiple=False,
placeholder='.pdf,
)

上传pdf文件时,大于10M的文件很多时候都会报错,错误如下:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xaf in position 1: invalid start byte

但同样的文件我通过iPhone iOS 15.3的chrome浏览器又能上传成功(有时候),有其他人和我说他们很多大文件pdf也都会传不上去。

我通过手机上传成功的这个pdf文件,我再进一步对它处理,也会报错。
但我直接在电脑上处理这个pdf文件却没有问题。
所以我感觉在file_upload这个function对于pdf的编码上是否存在一些问题?

环境信息

  • 操作系统及版本: Ubuntu 20
  • 浏览器及版本: Chrome, iphone chrome ... and other andriod phone web browser
  • Python版本: python3 .7
  • PyWebIO版本: 1.5.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions