Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError [ERR_UNESCAPED_CHARACTERS]: Request path contains unescaped characters at new ClientRequest #56

Closed
zhihuifanqiechaodan opened this issue Mar 20, 2021 · 2 comments

Comments

@zhihuifanqiechaodan
Copy link

"file-box": "^0.16.8"

const { FileBox } = require('file-box')

const fileBox = FileBox.fromUrl("https://s3.cn-northwest-1.amazonaws.com.cn/xiaoju-message-payload-bucket/message/6037190a939de800386de0c5/1616211743128/企业微信截图_1616211733614.png")

const imageStream = await fileBox.toStream();

(node:6173) UnhandledPromiseRejectionWarning: TypeError [ERR_UNESCAPED_CHARACTERS]: Request path contains unescaped characters
at new ClientRequest (_http_client.js:151:13)
at request (https.js:313:10)
at get (https.js:317:15)
at res (/Users/cctvabu/renhejituan/chatbot-webapi/node_modules/file-box/dist/src/misc.js:102:9)
at new Promise ()
at Object.httpStream (/Users/cctvabu/renhejituan/chatbot-webapi/node_modules/file-box/dist/src/misc.js:101:23)
at /Users/cctvabu/renhejituan/chatbot-webapi/node_modules/file-box/dist/src/file-box.js:374:24
at new Promise ()
at FileBox.transformUrlToStream (/Users/cctvabu/renhejituan/chatbot-webapi/node_modules/file-box/dist/src/file-box.js:372:16)
at FileBox.toStream (/Users/cctvabu/renhejituan/chatbot-webapi/node_modules/file-box/dist/src/file-box.js:318:37)
(node:6173) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 8)

@zhihuifanqiechaodan
Copy link
Author

const fileBox = FileBox.fromUrl(encodeURI(imageUrl))即可

huan added a commit that referenced this issue Mar 21, 2021
@huan
Copy link
Owner

huan commented Mar 21, 2021

Thank you very much for filing this issue and sharing your solution, appreciate it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants