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