fix front service upload

Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
Alexander Onnikov
2025-10-14 22:36:20 +07:00
parent 22f08817fa
commit 595c44e869
5 changed files with 34 additions and 10 deletions
+12
View File
@@ -1,6 +1,18 @@
{
"name": "@hcengineering/storage-client",
"entries": [
{
"version": "0.7.6",
"tag": "@hcengineering/storage-client_v0.7.6",
"date": "Tue, 14 Oct 2025 15:36:13 GMT",
"comments": {
"patch": [
{
"comment": "fix front service upload"
}
]
}
},
{
"version": "0.7.5",
"tag": "@hcengineering/storage-client_v0.7.5",
+8 -1
View File
@@ -1,6 +1,13 @@
# Change Log - @hcengineering/storage-client
This log was last generated on Tue, 14 Oct 2025 06:29:02 GMT and should not be manually modified.
This log was last generated on Tue, 14 Oct 2025 15:36:13 GMT and should not be manually modified.
## 0.7.6
Tue, 14 Oct 2025 15:36:13 GMT
### Patches
- fix front service upload
## 0.7.5
Tue, 14 Oct 2025 06:29:02 GMT
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@hcengineering/storage-client",
"version": "0.7.5",
"version": "0.7.6",
"main": "lib/index.js",
"svelte": "src/index.ts",
"types": "types/index.d.ts",
@@ -175,8 +175,10 @@ describe('FrontStorage', () => {
// Check FormData contents
const uploadCall = mockUploadXhr.mock.calls[0]
const formData = uploadCall[0].body as FormData
expect(formData.get('file')).toBe(file)
expect(formData.get('uuid')).toBe(uuid)
const uploadedFile = formData.get('file') as File
expect(uploadedFile).toBeInstanceOf(File)
expect(uploadedFile.name).toBe(uuid)
expect(uploadedFile.type).toBe('text/plain')
})
it('should upload file with progress tracking', async () => {
@@ -254,8 +256,10 @@ describe('FrontStorage', () => {
)
const formData = (mockUploadXhr.mock.calls[0][0] as any).body as FormData
expect(formData.get('file')).toBe(file)
expect(formData.get('uuid')).toBe(uuid)
const uploadedFile = formData.get('file') as File
expect(uploadedFile).toBeInstanceOf(File)
expect(uploadedFile.name).toBe(uuid)
expect(uploadedFile.type).toBe('image/png')
})
it('should handle empty files', async () => {
@@ -270,8 +274,10 @@ describe('FrontStorage', () => {
expect(mockUploadXhr).toHaveBeenCalled()
const formData = (mockUploadXhr.mock.calls[0][0] as any).body as FormData
expect(formData.get('file')).toBe(file)
expect(formData.get('uuid')).toBe(uuid)
const uploadedFile = formData.get('file') as File
expect(uploadedFile).toBeInstanceOf(File)
expect(uploadedFile.name).toBe(uuid)
expect(uploadedFile.type).toBe('text/plain')
})
})
+1 -2
View File
@@ -53,8 +53,7 @@ export class FrontStorage implements FileStorage {
options?: FileStorageUploadOptions
): Promise<void> {
const formData = new FormData()
formData.append('file', file)
formData.append('uuid', uuid)
formData.append('file', file, uuid)
await uploadXhr(
{