When reading the file address, if the file content contains special characters, the file cannot be found and an empty text file will be automatically opened.

When reading a file, sometimes the file cannot be opened and an empty text file is automatically generated. The reason may be that the file contains special characters. When url escaping is performed, the specified file cannot be found after encoding, and an error is finally reported.
When entering the URL address, you can use
the encodeURIComponent(path) method to escape the link.

const href = `/api/${
     
     Id}/file?access_token=${
     
     token}&path=${
     
     encodeURIComponent(path)}`;

Guess you like

Origin blog.csdn.net/m54584mnkj/article/details/132363405