nucliadb-utils 6.9.3.post5309__py3-none-any.whl → 6.9.4.post5370__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of nucliadb-utils might be problematic. Click here for more details.
- nucliadb_utils/storages/azure.py +16 -3
- nucliadb_utils/storages/s3.py +1 -1
- {nucliadb_utils-6.9.3.post5309.dist-info → nucliadb_utils-6.9.4.post5370.dist-info}/METADATA +4 -4
- {nucliadb_utils-6.9.3.post5309.dist-info → nucliadb_utils-6.9.4.post5370.dist-info}/RECORD +6 -6
- {nucliadb_utils-6.9.3.post5309.dist-info → nucliadb_utils-6.9.4.post5370.dist-info}/WHEEL +0 -0
- {nucliadb_utils-6.9.3.post5309.dist-info → nucliadb_utils-6.9.4.post5370.dist-info}/top_level.txt +0 -0
nucliadb_utils/storages/azure.py
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
from __future__ import annotations
|
|
22
22
|
|
|
23
|
+
import base64
|
|
23
24
|
import logging
|
|
24
25
|
from datetime import datetime
|
|
25
26
|
from typing import AsyncGenerator, AsyncIterator, Optional, Union
|
|
@@ -426,13 +427,20 @@ class AzureObjectStore(ObjectStore):
|
|
|
426
427
|
@ops_observer.wrap({"type": "multipart_start"})
|
|
427
428
|
async def upload_multipart_start(self, bucket: str, key: str, metadata: ObjectMetadata) -> None:
|
|
428
429
|
container_client = self.service_client.get_container_client(bucket)
|
|
429
|
-
custom_metadata = {
|
|
430
|
+
custom_metadata = {
|
|
431
|
+
"base64_filename": base64.b64encode(metadata.filename.encode()).decode(),
|
|
432
|
+
"content_type": metadata.content_type,
|
|
433
|
+
"size": str(metadata.size),
|
|
434
|
+
}
|
|
430
435
|
blob_client = container_client.get_blob_client(key)
|
|
436
|
+
safe_filename = (
|
|
437
|
+
metadata.filename.encode("ascii", "replace").decode().replace('"', "").replace("\n", "")
|
|
438
|
+
)
|
|
431
439
|
await blob_client.create_append_blob(
|
|
432
440
|
metadata=custom_metadata,
|
|
433
441
|
content_settings=ContentSettings(
|
|
434
442
|
content_type=metadata.content_type,
|
|
435
|
-
content_disposition=f
|
|
443
|
+
content_disposition=f'attachment; filename="{safe_filename}"',
|
|
436
444
|
),
|
|
437
445
|
)
|
|
438
446
|
|
|
@@ -460,7 +468,12 @@ def parse_object_metadata(properties: BlobProperties, key: str) -> ObjectMetadat
|
|
|
460
468
|
size = int(custom_metadata_size)
|
|
461
469
|
else:
|
|
462
470
|
size = properties.size
|
|
463
|
-
|
|
471
|
+
|
|
472
|
+
b64_filename = custom_metadata.get("base64_filename")
|
|
473
|
+
if b64_filename:
|
|
474
|
+
filename = base64.b64decode(b64_filename.encode()).decode()
|
|
475
|
+
else:
|
|
476
|
+
filename = key.split("/")[-1]
|
|
464
477
|
content_type = custom_metadata.get("content_type") or properties.content_settings.content_type or ""
|
|
465
478
|
return ObjectMetadata(
|
|
466
479
|
filename=filename,
|
nucliadb_utils/storages/s3.py
CHANGED
|
@@ -179,7 +179,7 @@ class S3StorageField(StorageField):
|
|
|
179
179
|
Bucket=bucket_name,
|
|
180
180
|
Key=upload_id,
|
|
181
181
|
Metadata={
|
|
182
|
-
"
|
|
182
|
+
"base64_filename": base64.b64encode(cf.filename.encode()).decode(),
|
|
183
183
|
"SIZE": str(cf.size),
|
|
184
184
|
"CONTENT_TYPE": cf.content_type,
|
|
185
185
|
},
|
{nucliadb_utils-6.9.3.post5309.dist-info → nucliadb_utils-6.9.4.post5370.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nucliadb_utils
|
|
3
|
-
Version: 6.9.
|
|
3
|
+
Version: 6.9.4.post5370
|
|
4
4
|
Summary: NucliaDB util library
|
|
5
5
|
Author-email: Nuclia <nucliadb@nuclia.com>
|
|
6
6
|
License-Expression: AGPL-3.0-or-later
|
|
@@ -26,9 +26,9 @@ Requires-Dist: nats-py[nkeys]>=2.6.0
|
|
|
26
26
|
Requires-Dist: PyNaCl
|
|
27
27
|
Requires-Dist: pyjwt>=2.4.0
|
|
28
28
|
Requires-Dist: mrflagly>=0.2.9
|
|
29
|
-
Requires-Dist: nidx-protos>=6.9.
|
|
30
|
-
Requires-Dist: nucliadb-protos>=6.9.
|
|
31
|
-
Requires-Dist: nucliadb-telemetry>=6.9.
|
|
29
|
+
Requires-Dist: nidx-protos>=6.9.4.post5370
|
|
30
|
+
Requires-Dist: nucliadb-protos>=6.9.4.post5370
|
|
31
|
+
Requires-Dist: nucliadb-telemetry>=6.9.4.post5370
|
|
32
32
|
Provides-Extra: cache
|
|
33
33
|
Requires-Dist: redis>=4.3.4; extra == "cache"
|
|
34
34
|
Requires-Dist: orjson>=3.6.7; extra == "cache"
|
|
@@ -35,13 +35,13 @@ nucliadb_utils/nuclia_usage/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn
|
|
|
35
35
|
nucliadb_utils/nuclia_usage/utils/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
|
|
36
36
|
nucliadb_utils/nuclia_usage/utils/kb_usage_report.py,sha256=6lLuxCCPQVn3dOuZNL5ThPjl2yws-1TJ_7duhQSWkPU,3934
|
|
37
37
|
nucliadb_utils/storages/__init__.py,sha256=5Qc8AUWiJv9_JbGCBpAn88AIJhwDlm0OPQpg2ZdRL4U,872
|
|
38
|
-
nucliadb_utils/storages/azure.py,sha256=
|
|
38
|
+
nucliadb_utils/storages/azure.py,sha256=t0ZL_698NqsBz-Ihwkc79tusfzGcm0BVTB5pqceNlvA,18456
|
|
39
39
|
nucliadb_utils/storages/exceptions.py,sha256=6YhFLf8k0ABy5AVfxIJUo7w6AK0SJjktiyQTwF3gCdg,2344
|
|
40
40
|
nucliadb_utils/storages/gcs.py,sha256=VyT72My34N4pEMmrQc5wdAMNLiuqpYl8OW3d50cJfSA,28222
|
|
41
41
|
nucliadb_utils/storages/local.py,sha256=2aCHpZymORG_dUc1FDq0VFcgQulu0w2pZiUaj9dphFs,11686
|
|
42
42
|
nucliadb_utils/storages/nuclia.py,sha256=vEv94xAT7QM2g80S25QyrOw2pzvP2BAX-ADgZLtuCVc,2097
|
|
43
43
|
nucliadb_utils/storages/object_store.py,sha256=2PueRP5Q3XOuWgKhj6B9Kp2fyBql5np0T400YRUbqn4,4535
|
|
44
|
-
nucliadb_utils/storages/s3.py,sha256=
|
|
44
|
+
nucliadb_utils/storages/s3.py,sha256=EUqlNoJW32AI6jpETbDla3teYbxlz8RFTfxSdHgWZdo,21878
|
|
45
45
|
nucliadb_utils/storages/settings.py,sha256=mepN3wbLGL0Pv5yI6D-sNjSAFinEWT7aRi6N3eClNDg,1384
|
|
46
46
|
nucliadb_utils/storages/storage.py,sha256=aOJnx6-WX8U3AAqPL_sWPCghIzlr8e3GKGi8z3-mtqw,22024
|
|
47
47
|
nucliadb_utils/storages/utils.py,sha256=F4Iboa_0_bhDQr-JOKD9sGPld_-hKwJW5ptyZdn9Oag,1505
|
|
@@ -53,7 +53,7 @@ nucliadb_utils/tests/gcs.py,sha256=JNqp5ymeNNU9Ci8rNYTh7-VqP4fjybElhyB3ap7EV1c,4
|
|
|
53
53
|
nucliadb_utils/tests/local.py,sha256=z9E11_ol1mu7N8Y6PkjKl-WMPPMl7JqQbDj3uhVa1A0,1933
|
|
54
54
|
nucliadb_utils/tests/nats.py,sha256=rbTaC6kv-u6SdZ7N-XBEGS40XCRiUmFUsKHIYWJfxTs,2325
|
|
55
55
|
nucliadb_utils/tests/s3.py,sha256=kz9ULxrAYLVslZ59I8dtweZ9DJz5R8Ioy2XYrveZzHw,3829
|
|
56
|
-
nucliadb_utils-6.9.
|
|
57
|
-
nucliadb_utils-6.9.
|
|
58
|
-
nucliadb_utils-6.9.
|
|
59
|
-
nucliadb_utils-6.9.
|
|
56
|
+
nucliadb_utils-6.9.4.post5370.dist-info/METADATA,sha256=a31NJCsddxx6qGHoAxVesGQuOG-Xe7VDRoAqL3i6X-g,2174
|
|
57
|
+
nucliadb_utils-6.9.4.post5370.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
58
|
+
nucliadb_utils-6.9.4.post5370.dist-info/top_level.txt,sha256=fE3vJtALTfgh7bcAWcNhcfXkNPp_eVVpbKK-2IYua3E,15
|
|
59
|
+
nucliadb_utils-6.9.4.post5370.dist-info/RECORD,,
|
|
File without changes
|
{nucliadb_utils-6.9.3.post5309.dist-info → nucliadb_utils-6.9.4.post5370.dist-info}/top_level.txt
RENAMED
|
File without changes
|