fix(rnotes): fix vault upload — field name mismatch and missing auth header
The upload form sent the file as "vault" but the server expected "file", causing all uploads to fail with 400. Also added the encryptid JWT token to the upload request so authenticated routes don't return 401. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
0b1e33e1d2
commit
79d24a327e
|
|
@ -268,7 +268,12 @@ export class FolkNotesApp extends HTMLElement {
|
|||
this._render();
|
||||
try {
|
||||
const base = this._getApiBase();
|
||||
const res = await fetch(`${base}/api/vault/upload`, { method: 'POST', body: fd });
|
||||
const token = localStorage.getItem('encryptid-token');
|
||||
const res = await fetch(`${base}/api/vault/upload`, {
|
||||
method: 'POST',
|
||||
body: fd,
|
||||
headers: token ? { 'Authorization': `Bearer ${token}` } : {},
|
||||
});
|
||||
const data = await res.json();
|
||||
if (res.ok) {
|
||||
this._uploadStatus = `Vault uploaded: ${data.name ?? 'done'}`;
|
||||
|
|
@ -534,7 +539,7 @@ ${this._uploadOpen ? this._renderUploadDialog() : ''}
|
|||
</div>
|
||||
<div class="field">
|
||||
<label>Vault ZIP File</label>
|
||||
<input type="file" name="vault" accept=".zip" required>
|
||||
<input type="file" name="file" accept=".zip" required>
|
||||
</div>
|
||||
<div class="status-msg" id="upload-status">${escHtml(this._uploadStatus)}</div>
|
||||
<div class="dialog-actions">
|
||||
|
|
|
|||
Loading…
Reference in New Issue