diff --git a/apps/desktop/src/app/sync/destinations/nuclia-cloud.ts b/apps/desktop/src/app/sync/destinations/nuclia-cloud.ts index f0c0da73b..e5cec0bc9 100644 --- a/apps/desktop/src/app/sync/destinations/nuclia-cloud.ts +++ b/apps/desktop/src/app/sync/destinations/nuclia-cloud.ts @@ -1,5 +1,5 @@ -import { FIELD_TYPE, INuclia, Nuclia, NucliaOptions, ResourceProperties, WritableKnowledgeBox } from '@nuclia/core'; -import { map, Observable, of, switchMap, delay } from 'rxjs'; +import { INuclia, Nuclia, NucliaOptions, WritableKnowledgeBox } from '@nuclia/core'; +import { map, Observable, of, switchMap } from 'rxjs'; import { ConnectorParameters, ConnectorSettings, @@ -7,6 +7,7 @@ import { Field, IDestinationConnector, } from '../models'; +import { lookup } from 'mime-types'; const ACCOUNT_KEY = 'NUCLIA_ACCOUNT'; @@ -52,7 +53,15 @@ class NucliaCloudKBImpl implements IDestinationConnector { const kb$ = this.kb ? of(this.kb) : this.nuclia.db.getKnowledgeBox(localStorage.getItem(ACCOUNT_KEY) || '', params['kb']); - return kb$.pipe(switchMap((kb) => kb.upload(new File([blob], filename)).pipe(map(() => undefined)))); + return kb$.pipe( + switchMap((kb) => + kb + .upload(new File([blob], filename), false, { + contentType: lookup(filename) || 'application/octet-stream', + }) + .pipe(map(() => undefined)), + ), + ); } else { return of(undefined); } diff --git a/package.json b/package.json index e49945ee3..a568a0c77 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nuclia", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "author": "Nuclia.cloud", "description": "Nuclia frontend apps and libs", @@ -56,6 +56,7 @@ "fuse.js": "^3.6.1", "googleapis": "^110.0.0", "latinize": "^0.5.0", + "mime-types": "^2.1.35", "mrs-developer": "^1.7.1", "ngx-captcha": "^12.0.2", "node-machine-id": "^1.1.12", @@ -109,6 +110,7 @@ "@types/jexl": "^2.2.0", "@types/latinize": "^0.2.15", "@types/lru-cache": "^5.1.0", + "@types/mime-types": "^2.1.1", "@types/node": "18.7.1", "@types/perfect-scrollbar": "^1.3.0", "@types/spark-md5": "^3.0.2", diff --git a/yarn.lock b/yarn.lock index b7b8cba7f..6e21b58f7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7386,6 +7386,13 @@ __metadata: languageName: node linkType: hard +"@types/mime-types@npm:^2.1.1": + version: 2.1.1 + resolution: "@types/mime-types@npm:2.1.1" + checksum: 106b5d556add46446a579ad25ff15d6b421851790d887edcad558c90c1e64b1defc72bfbaf4b08f208916e21d9cc45cdb951d77be51268b18221544cfe054a3c + languageName: node + linkType: hard + "@types/mime@npm:^1": version: 1.3.2 resolution: "@types/mime@npm:1.3.2" @@ -18302,7 +18309,7 @@ __metadata: languageName: node linkType: hard -"mime-types@npm:^2.1.11, mime-types@npm:^2.1.12, mime-types@npm:^2.1.27, mime-types@npm:^2.1.31, mime-types@npm:~2.1.17, mime-types@npm:~2.1.19, mime-types@npm:~2.1.24, mime-types@npm:~2.1.34, mime-types@npm:~2.1.7": +"mime-types@npm:^2.1.11, mime-types@npm:^2.1.12, mime-types@npm:^2.1.27, mime-types@npm:^2.1.31, mime-types@npm:^2.1.35, mime-types@npm:~2.1.17, mime-types@npm:~2.1.19, mime-types@npm:~2.1.24, mime-types@npm:~2.1.34, mime-types@npm:~2.1.7": version: 2.1.35 resolution: "mime-types@npm:2.1.35" dependencies: @@ -19397,6 +19404,7 @@ __metadata: "@types/jexl": ^2.2.0 "@types/latinize": ^0.2.15 "@types/lru-cache": ^5.1.0 + "@types/mime-types": ^2.1.1 "@types/node": 18.7.1 "@types/perfect-scrollbar": ^1.3.0 "@types/spark-md5": ^3.0.2 @@ -19433,6 +19441,7 @@ __metadata: jest-environment-jsdom: 28.1.1 jest-preset-angular: 12.2.2 latinize: ^0.5.0 + mime-types: ^2.1.35 mrs-developer: ^1.7.1 ng-mocks: ^14.1.1 ng-packagr: 14.2.0