Decode URL of title

This commit is contained in:
Marcus Noble 2020-10-18 11:13:29 +01:00
parent 3bde6af554
commit 14b9363462

View File

@ -73,7 +73,7 @@ async function sendPDF(website, tries = 0) {
const response = await axios.get(website.toString(), { const response = await axios.get(website.toString(), {
responseType: 'arraybuffer' responseType: 'arraybuffer'
}) })
const title = website.toString().substring(website.toString().lastIndexOf("/")+1, website.toString().lastIndexOf(".")) const title = decodeURIComponent(website.toString().substring(website.toString().lastIndexOf("/")+1, website.toString().lastIndexOf(".")));
await sendToRemarkable(title, Buffer.from(response.data, 'binary')); await sendToRemarkable(title, Buffer.from(response.data, 'binary'));
return true; return true;
@ -92,7 +92,7 @@ async function sendEpub(website, tries = 0) {
const response = await axios.get(website.toString(), { const response = await axios.get(website.toString(), {
responseType: 'arraybuffer' responseType: 'arraybuffer'
}) })
const title = website.toString().substring(website.toString().lastIndexOf("/")+1, website.toString().lastIndexOf(".")) const title = decodeURIComponent(website.toString().substring(website.toString().lastIndexOf("/")+1, website.toString().lastIndexOf(".")));
await sendToRemarkable(title, Buffer.from(response.data, 'binary'), 'epub'); await sendToRemarkable(title, Buffer.from(response.data, 'binary'), 'epub');
return true; return true;