fixes filename encoding
This commit is contained in:
1 parent
c6f30c6f76
commit
0cd755fe8d
2 files changed
+6
-2
No files matched your search
+4
-2
@@ -107,16 +107,18 @@
|
||||
const hashHex = await computeSHA256(file);
|
||||
appendLog(`Computed SHA-256 hash: ${hashHex}`);
|
||||
|
||||
// Prepare the POST request with file as body and header X-Content-SHA256
|
||||
// Prepare the POST request with file as body and additional header for filename
|
||||
const encodedFileName = btoa(unescape(encodeURIComponent(file.name)));
|
||||
const response = await fetch(BASE_URL, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"X-Content-SHA256": hashHex,
|
||||
"X-File-Name": file.name, // NEW: передаём имя файла
|
||||
"X-File-Name": encodedFileName, // NEW: передаём имя файла в base64
|
||||
"Content-Type": file.type || "application/octet-stream"
|
||||
},
|
||||
body: file
|
||||
});
|
||||
|
||||
|
||||
if (!response.ok) {
|
||||
const errorData = await response.json();
|
||||
|
||||
Reference in new issue
Block a user