fix: slice File to Blob before append so 3rd-arg filename is always used
This commit is contained in:
@@ -138,8 +138,9 @@ function initUpload(formEl) {
|
|||||||
status.className = 'gpx-status';
|
status.className = 'gpx-status';
|
||||||
btn.disabled = true;
|
btn.disabled = true;
|
||||||
|
|
||||||
|
const slugged = slugifyFilename(file.name);
|
||||||
const fd = new FormData();
|
const fd = new FormData();
|
||||||
fd.append('file', file, slugifyFilename(file.name));
|
fd.append('file', file.slice(0, file.size, file.type), slugged);
|
||||||
|
|
||||||
const res = await apiFetch(`${API}/pages${route}/media`, { method: 'POST', body: fd });
|
const res = await apiFetch(`${API}/pages${route}/media`, { method: 'POST', body: fd });
|
||||||
btn.disabled = false;
|
btn.disabled = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user