Invalid character found in the request target [/api/hsFile/download?filePath=E:\\%E4%B8%B4%E6%97%B6%E6%96%87%E4%BB%B6&fileName=aaaaa.xlsx]. The valid characters are defined in RFC 7230 and RFC 3986

java.lang.IllegalArgumentException: Invalid character found in the request target [/api/hsFile/download?filePath=E:\\%E4%B8%B4%E6%97%B6%E6%96%87%E4%BB%B6&fileName=aaaaa.xlsx]. The valid characters are defined in RFC 7230 and RFC 3986

1、原因:

/api/hsFile/download?filePath=E:\\%E4%B8%B4%E6%97%B6%E6%96%87%E4%BB%B6&fileName=aaaaa.xlsx

url 的%E4%B8%B4%E6%97%B6%E6%96%87%E4%BB%B6 这段字符有问题

这种情况一般是把中文直接放到url上面导致的。

 

2、解决办法:

在传输前就要进行转义。

 

posted @ 2023-06-25 11:12  信铁寒胜  阅读(519)  评论(0编辑  收藏  举报