Skip to content

Commit cfe2d77

Browse files
authored
Merge pull request #303 from poissoncorp/RavenDB-26793
RavenDB-26793 Time-series bulk-insert UTC fix + custom-entity-name control-char guard
2 parents c3f3ca5 + af94dd8 commit cfe2d77

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

ravendb/tests/jvm_migrated_tests/client_tests/test_custom_entity_name.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ def _customize_store(self, store: DocumentStore) -> None:
100100
)
101101

102102
def __test_when_collection_and_id_contain_special_chars(self, c: str) -> None:
103-
if 14 <= ord(c) <= 31:
103+
# RavenDB now rejects control characters in document ids (including the generated HiLo id),
104+
# so skip the whole C0 control range rather than only 14..31.
105+
if ord(c) <= 31:
104106
return
105107

106108
self.c = c

ravendb/tools/utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from collections import Iterable, Sequence
1616

1717
from ravendb.tools.projection import create_entity_with_mapper
18-
from datetime import datetime, timedelta
18+
from datetime import datetime, timedelta, timezone
1919
from enum import Enum
2020
from threading import Timer
2121
from copy import deepcopy
@@ -958,4 +958,8 @@ def add_minutes(date: datetime, minutes: int):
958958

959959
@staticmethod
960960
def get_unix_time_in_ms(date: datetime) -> int:
961+
# Naive datetimes are treated as UTC (consistent with Utils.datetime_to_string) so that
962+
# bulk-insert time-series timestamps are not shifted by the machine's local UTC offset.
963+
if date.tzinfo is None:
964+
date = date.replace(tzinfo=timezone.utc)
961965
return int(date.timestamp() * 1000)

0 commit comments

Comments
 (0)