nucliadb-utils 6.9.1.post5229__py3-none-any.whl → 6.9.6.post5473__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/const.py CHANGED
@@ -41,4 +41,4 @@ class Features:
41
41
  SKIP_EXTERNAL_INDEX = "nucliadb_skip_external_index"
42
42
  LOG_REQUEST_PAYLOADS = "nucliadb_log_request_payloads"
43
43
  IGNORE_EXTRACTED_IN_SEARCH = "nucliadb_ignore_extracted_in_search"
44
- REBALANCE_ENABLED = "nucliadb_rebalance"
44
+ ASK_DECOUPLED = "nucliadb_ask_decoupled"
@@ -45,7 +45,10 @@ DEFAULT_FLAG_DATA: dict[str, Any] = {
45
45
  "rollout": 0,
46
46
  "variants": {"environment": ["local"]},
47
47
  },
48
- const.Features.REBALANCE_ENABLED: {"rollout": 0, "variants": {"environment": ["local"]}},
48
+ const.Features.ASK_DECOUPLED: {
49
+ "rollout": 0,
50
+ "variants": {"environment": ["local"]},
51
+ },
49
52
  }
50
53
 
51
54
 
@@ -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 = {key: str(value) for key, value in metadata.model_dump().items()}
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"attachment; filename={metadata.filename}",
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
- filename = custom_metadata.get("filename") or key.split("/")[-1]
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,
@@ -179,7 +179,7 @@ class S3StorageField(StorageField):
179
179
  Bucket=bucket_name,
180
180
  Key=upload_id,
181
181
  Metadata={
182
- "FILENAME": cf.filename,
182
+ "base64_filename": base64.b64encode(cf.filename.encode()).decode(),
183
183
  "SIZE": str(cf.size),
184
184
  "CONTENT_TYPE": cf.content_type,
185
185
  },
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nucliadb_utils
3
- Version: 6.9.1.post5229
3
+ Version: 6.9.6.post5473
4
4
  Summary: NucliaDB util library
5
5
  Author-email: Nuclia <nucliadb@nuclia.com>
6
6
  License-Expression: AGPL-3.0-or-later
@@ -8,13 +8,12 @@ Project-URL: Homepage, https://nuclia.com
8
8
  Project-URL: Repository, https://github.com/nuclia/nucliadb
9
9
  Classifier: Development Status :: 4 - Beta
10
10
  Classifier: Programming Language :: Python
11
- Classifier: Programming Language :: Python :: 3.9
12
11
  Classifier: Programming Language :: Python :: 3.10
13
12
  Classifier: Programming Language :: Python :: 3.11
14
13
  Classifier: Programming Language :: Python :: 3.12
15
14
  Classifier: Programming Language :: Python :: 3 :: Only
16
15
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
17
- Requires-Python: <4,>=3.9
16
+ Requires-Python: <4,>=3.10
18
17
  Description-Content-Type: text/markdown
19
18
  Requires-Dist: pydantic>=2.6
20
19
  Requires-Dist: pydantic-settings>=2.2
@@ -27,8 +26,9 @@ Requires-Dist: nats-py[nkeys]>=2.6.0
27
26
  Requires-Dist: PyNaCl
28
27
  Requires-Dist: pyjwt>=2.4.0
29
28
  Requires-Dist: mrflagly>=0.2.9
30
- Requires-Dist: nucliadb-protos>=6.9.1.post5229
31
- Requires-Dist: nucliadb-telemetry>=6.9.1.post5229
29
+ Requires-Dist: nidx-protos>=6.9.6.post5473
30
+ Requires-Dist: nucliadb-protos>=6.9.6.post5473
31
+ Requires-Dist: nucliadb-telemetry>=6.9.6.post5473
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"
@@ -1,10 +1,10 @@
1
1
  nucliadb_utils/__init__.py,sha256=EvBCH1iTODe-AgXm48aj4kVUt_Std3PeL8QnwimR5wI,895
2
2
  nucliadb_utils/asyncio_utils.py,sha256=h8Y-xpcFFRgNzaiIW0eidz7griAQa7ggbNk34-tAt2c,2888
3
3
  nucliadb_utils/authentication.py,sha256=5_b323v2ylJaJvM_0coeSQEtnD-p9IGD-6CPA6IXhik,6471
4
- nucliadb_utils/const.py,sha256=YtWadXGm044MbwLcfEImNC6skh3e4LKZDu6hjlO0qMU,1521
4
+ nucliadb_utils/const.py,sha256=F1kZzTSbJvg9YYGhSi-H6KJsfTkTiX8PER4RBAOkq40,1521
5
5
  nucliadb_utils/debug.py,sha256=Q56Nx9Dp7V2ae3CU2H0ztaZcHTJXdlflPLKLeOPZ170,2436
6
6
  nucliadb_utils/exceptions.py,sha256=y_3wk77WLVUtdo-5FtbBsdSkCtK_DsJkdWb5BoPn3qo,1094
7
- nucliadb_utils/featureflagging.py,sha256=ctd9Nqm_nhoedMIV2GC819-cSP5GlkLYXCRE0DbwxYU,2353
7
+ nucliadb_utils/featureflagging.py,sha256=oKlSC3B-Bfx7xdrpalpmqUk3nCkMIm7BjyBMWlHC_RU,2372
8
8
  nucliadb_utils/grpc.py,sha256=apu0uePnkGHCAT7GRQ9YZfRYyFj26kJ440i8jitbM3U,3314
9
9
  nucliadb_utils/helpers.py,sha256=eed7_E1MKh9eW3CpqOXka3OvLw5C9eJGC_R-1MPYdfY,3336
10
10
  nucliadb_utils/nats.py,sha256=U21Cfg36_IHd3ZLXEC4eZ7nZ1Soh_ZNFFwjryNyd2-8,15248
@@ -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=pu0IyKPCn32oT0wI3oJIG6iUxnPtwNgg1zu00C8wDjo,18057
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=eFFVRgNTIxTz1Hpmd6ofRz9KQhPJAmiyetW4EmWN8EM,21835
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.1.post5229.dist-info/METADATA,sha256=QkcqFXWPuu1Cz5lt5ecN5osQjyvtVIXjUxE-Rde2S3c,2180
57
- nucliadb_utils-6.9.1.post5229.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
58
- nucliadb_utils-6.9.1.post5229.dist-info/top_level.txt,sha256=fE3vJtALTfgh7bcAWcNhcfXkNPp_eVVpbKK-2IYua3E,15
59
- nucliadb_utils-6.9.1.post5229.dist-info/RECORD,,
56
+ nucliadb_utils-6.9.6.post5473.dist-info/METADATA,sha256=V7vJvzCfdw4mJL-cZGkQsfGEdo45BVnKX1rI1OBg7fw,2174
57
+ nucliadb_utils-6.9.6.post5473.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
58
+ nucliadb_utils-6.9.6.post5473.dist-info/top_level.txt,sha256=fE3vJtALTfgh7bcAWcNhcfXkNPp_eVVpbKK-2IYua3E,15
59
+ nucliadb_utils-6.9.6.post5473.dist-info/RECORD,,