Creé un proyecto de pila MERN que toma enlaces de los libros y cuando haces clic en el nombre del libro, puedes descargar los libros. Pero mis enlaces href no me llevan al enlace correcto a pesar de que mi enlace dentro de la etiqueta es correcto cuando lo inspecciono en las herramientas de desarrollo. Mi aplicación funciona bien en localhost. Pero cuando lo implemento en Heroku, me enfrento a este problema. Aquí está mi opinión que me redirige a la dirección incorrecta.
<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>No sé si Yandex o Google me restringen por motivos de seguridad. Aquí la aplicación que implementé en heroku. mi-aplicacion
Quiero compartir mi código que muestra cómo obtengo estos enlaces de descarga. También agregué encodeURI pero no funcionó.
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); }); });Cuando hago clic derecho en un libro después de la búsqueda, luego copio la dirección del enlace, está funcionando. Pero al hacer clic no funciona.