fix: upload works in both Docker and dev mode

Falls back to absolute path on host when /app/screenshots doesn't exist.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Yusuf Suleman
2026-04-01 21:56:26 -05:00
parent f94987ac1b
commit e1f18cfb18
3 changed files with 33 additions and 17 deletions

View File

@@ -59,10 +59,13 @@
const fd = new FormData();
fd.append('file', file);
try {
await fetch('/upload', { method: 'POST', body: fd, credentials: 'include' });
uploadStatus = 'done';
setTimeout(() => uploadStatus = '', 2000);
} catch {
const res = await fetch('/upload', { method: 'POST', body: fd, credentials: 'include' });
const data = await res.json();
console.log('Upload result:', data);
uploadStatus = data.ok ? 'done' : '';
if (data.ok) setTimeout(() => uploadStatus = '', 2000);
} catch (e) {
console.error('Upload error:', e);
uploadStatus = '';
}
}