forked from FoundKeyGang/FoundKey
Encode fetch URI if needed (#2649)
This commit is contained in:
parent
d92e9759f3
commit
769960f29e
1 changed files with 2 additions and 1 deletions
|
@ -34,8 +34,9 @@ export default async (url: string, user: IUser, folderId: mongodb.ObjectID = nul
|
|||
// write content at URL to temp file
|
||||
await new Promise((res, rej) => {
|
||||
const writable = fs.createWriteStream(path);
|
||||
const requestUrl = URL.parse(url).pathname.match(/[^\u0021-\u00ff]/) ? encodeURI(url) : url;
|
||||
request({
|
||||
url,
|
||||
url: requestUrl,
|
||||
headers: {
|
||||
'User-Agent': config.user_agent
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue