mirror of
https://github.com/christianvidalwolf-prog/Craze-Data-check.git
synced 2026-08-03 12:15:24 +02:00
fix: update dropbox sharing link to the new version
This commit is contained in:
@@ -42,14 +42,21 @@ export default async function handler(req, res) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const sharingUrl = 'https://www.dropbox.com/scl/fi/ulcgt5iyyvrkeynprhali/Data-Matrix.xlsx?rlkey=i9p9xgwzm0fr7jip91vxdeal5&st=k8jmibh4&dl=1';
|
const sharingUrl = 'https://www.dropbox.com/scl/fi/8qbl7uoigtfu5x1nn8wvm/Data-Matrix.xlsx?rlkey=s6rkwa2bjrx9gh442gw6w40uk&dl=1';
|
||||||
const upstream = await fetch(sharingUrl, {
|
const upstream = await fetch(sharingUrl, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
'Cache-Control': 'no-cache'
|
'Cache-Control': 'no-cache',
|
||||||
|
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const contentType = upstream.headers.get('content-type');
|
||||||
|
if (contentType && contentType.includes('text/html')) {
|
||||||
|
console.error('Dropbox returned HTML instead of file');
|
||||||
|
return res.status(500).send('Error: El enlace de Dropbox ha devuelto una página HTML en lugar del archivo. Es probable que el enlace haya caducado o necesite ser renovado.');
|
||||||
|
}
|
||||||
|
|
||||||
if (!upstream.ok) {
|
if (!upstream.ok) {
|
||||||
const errText = await upstream.text();
|
const errText = await upstream.text();
|
||||||
console.error('Dropbox URL error:', upstream.status, errText);
|
console.error('Dropbox URL error:', upstream.status, errText);
|
||||||
|
|||||||
+6
-1
@@ -61,10 +61,15 @@ export default function App() {
|
|||||||
|
|
||||||
if (isDev) {
|
if (isDev) {
|
||||||
const cacheBuster = `t_${Date.now()}`;
|
const cacheBuster = `t_${Date.now()}`;
|
||||||
const fileUrl = `/dropbox-file/scl/fi/ulcgt5iyyvrkeynprhali/Data-Matrix.xlsx?rlkey=i9p9xgwzm0fr7jip91vxdeal5&st=k8jmibh4&dl=1&${cacheBuster}=${Date.now()}`;
|
const fileUrl = `/dropbox-file/scl/fi/8qbl7uoigtfu5x1nn8wvm/Data-Matrix.xlsx?rlkey=s6rkwa2bjrx9gh442gw6w40uk&dl=1&${cacheBuster}=${Date.now()}`;
|
||||||
console.log('Fetching Data-Matrix.xlsx from Dropbox (hard refresh)...');
|
console.log('Fetching Data-Matrix.xlsx from Dropbox (hard refresh)...');
|
||||||
const response = await fetch(fileUrl, { cache: 'no-store' });
|
const response = await fetch(fileUrl, { cache: 'no-store' });
|
||||||
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
||||||
|
|
||||||
|
const contentType = response.headers.get('content-type');
|
||||||
|
if (contentType && contentType.includes('text/html')) {
|
||||||
|
throw new Error('Dropbox returned an HTML page instead of the Excel file. This usually means the sharing link has expired or requires manual interaction. Please generate a new "Copy Link" from Dropbox.');
|
||||||
|
}
|
||||||
const arrayBuffer = await response.arrayBuffer();
|
const arrayBuffer = await response.arrayBuffer();
|
||||||
if (arrayBuffer.byteLength < 100) throw new Error('File too small');
|
if (arrayBuffer.byteLength < 100) throw new Error('File too small');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user