I have created a MERN stack project that takes links of the books and when you click on the name of the book, you can download the books. But my href links doesn't take me to right link even though my link inside the tag is right when I inspect it in the developer tools. My app is working well in localhost. But when I deploy it on Heroku, I face this issue. Here is my take that redirects me to the wrong address.
<a href="https://downloader.disk.yandex.ru/disk/80cbc9fad2fdcc069ca7b58e862b3181f46aeff20e9049ff9f3dbd93806051b1/6163214b/G5C0TX8CiPWFWwuAp3xzTufPyksiVML-SpOQbOukZFCoTLy-nqnTLWx0QHJJrpzusZJDu--tT6ghjzdgmnnIhg%3D%3D?uid=0&filename=Ahmet%20Alpan%20-%20Dost%20Bombalar.epub&disposition=attachment&hash=I9yUHj%2BS67IaRxOANlGbhkKhx%2BMb83KCZa7A9q6PB7NuJBmsS3ntyZUZhtgmzgqmq/J6bpmRyOJonT3VoXnDag%3D%3D%3A/Meritokrasi/T%C3%BCrk%C3%A7e%20%5BePub%5D/Derecelendirilmi%C5%9F%20Kitaplar/Ahmet%20Alpan%20-%20Dost%20Bombalar.epub&limit=0&content_type=application%2Fx-bittorrent&owner_uid=1327282368&fsize=163051&hid=15e448431fdbeff8567e22e9ecb6b8c6&media_type=book&tknv=v2">Ahmet Alpan - Dost Bombalar.epub</a>
I don't know if Yandex or google restrict me for security reasons. Here the app that I deployed in heroku. my-app
I want to share my code that shows how I fetch these download links. I also added encodeURI but it did not work.
fetch(`/books/${search}`)
.then((res) => res.json())
.then((d) => {
Promise.all(
d.map((e) => {
return fetch(
encodeURI(
`https://cloud-api.yandex.net:443/v1/disk/public/resources/download?public_key=https://disk.yandex.ru/d/o9lNK0tpVCH7sQ&path=${e.path}`
)
)
.then((res) => res.json())
.then((res) => {
return {
name: e.name,
size: bytes2Size(e.size),
date: new Date(e.date).toLocaleDateString(),
file: res.href,
};
});
})
).then((data) => {
setBooks(data);
setIsLoaded(true);
setisLoading(false);
});
});
When I right-click on a book after search, then copy the link address, it is working. But when clicking it is not working.