mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-12-24 05:33:08 +02:00
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