Skip to content

Commit 5df20b7

Browse files
Source Hubspot: fix URI too long issue (#13691)
* #268: fix URI too long (HubSpot) * #268 upd changelog * #268 oncall: review fix * auto-bump connector version Co-authored-by: Octavia Squidington III <[email protected]>
1 parent 6c8cae2 commit 5df20b7

File tree

6 files changed

+30
-5
lines changed

6 files changed

+30
-5
lines changed

airbyte-config/init/src/main/resources/seed/source_definitions.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@
390390
- name: HubSpot
391391
sourceDefinitionId: 36c891d9-4bd9-43ac-bad2-10e12756272c
392392
dockerRepository: airbyte/source-hubspot
393-
dockerImageTag: 0.1.68
393+
dockerImageTag: 0.1.69
394394
documentationUrl: https://docs.airbyte.io/integrations/sources/hubspot
395395
icon: hubspot.svg
396396
sourceType: api

airbyte-config/init/src/main/resources/seed/source_specs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3637,7 +3637,7 @@
36373637
supportsNormalization: false
36383638
supportsDBT: false
36393639
supported_destination_sync_modes: []
3640-
- dockerImage: "airbyte/source-hubspot:0.1.68"
3640+
- dockerImage: "airbyte/source-hubspot:0.1.69"
36413641
spec:
36423642
documentationUrl: "https://docs.airbyte.io/integrations/sources/hubspot"
36433643
connectionSpecification:

airbyte-integrations/connectors/source-hubspot/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ COPY source_hubspot ./source_hubspot
3434
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
3535
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]
3636

37-
LABEL io.airbyte.version=0.1.68
37+
LABEL io.airbyte.version=0.1.69
3838
LABEL io.airbyte.name=airbyte/source-hubspot

airbyte-integrations/connectors/source-hubspot/source_hubspot/streams.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,14 @@ def split_properties(properties_list: List[str]) -> Iterator[Tuple[str]]:
6464
summary_length = 0
6565
local_properties = []
6666
for property_ in properties_list:
67-
if len(property_) + summary_length + len(urllib.parse.quote(",")) >= PROPERTIES_PARAM_MAX_LENGTH:
67+
current_property_length = len(urllib.parse.quote(f"property={property_}&"))
68+
if current_property_length + summary_length >= PROPERTIES_PARAM_MAX_LENGTH:
6869
yield local_properties
6970
local_properties = []
7071
summary_length = 0
7172

7273
local_properties.append(property_)
73-
summary_length += len(property_) + len(urllib.parse.quote(","))
74+
summary_length += current_property_length
7475

7576
if local_properties:
7677
yield local_properties
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#
2+
# Copyright (c) 2022 Airbyte, Inc., all rights reserved.
3+
#
4+
5+
import pytest
6+
from source_hubspot.streams import split_properties
7+
8+
lorem_ipsum = """Lorem ipsum dolor sit amet, consectetur adipiscing elit"""
9+
lorem_ipsum = lorem_ipsum.lower().replace(",", "")
10+
11+
many_properties = lorem_ipsum.split(" ") * 100
12+
few_properties = ["firstname", "lastname", "age", "dob", "id"]
13+
14+
15+
@pytest.mark.parametrize(("properties", "chunks_expected"), ((few_properties, 1), (many_properties, 2)))
16+
def test_split_properties(properties, chunks_expected):
17+
chunked_properties = set()
18+
index = 0
19+
for index, chunk in enumerate(split_properties(properties)):
20+
chunked_properties |= set(chunk)
21+
chunks = index + 1
22+
assert chunked_properties == set(properties)
23+
assert chunks == chunks_expected

docs/integrations/sources/hubspot.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ HubSpot's API will [rate limit](https://developers.hubspot.com/docs/api/usage-de
133133

134134
| Version | Date | Pull Request | Subject |
135135
|:--------|:-----------|:---------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------|
136+
| 0.1.69 | 2022-06-10 | [13691](https://github.com/airbytehq/airbyte/pull/13691) | Fix the `URI Too Long` issue |
136137
| 0.1.68 | 2022-06-08 | [13596](https://github.com/airbytehq/airbyte/pull/13596) | Fix for the `property_history` which did not emit records |
137138
| 0.1.67 | 2022-06-07 | [13566](https://github.com/airbytehq/airbyte/pull/13566) | Report which scopes are missing to the user |
138139
| 0.1.66 | 2022-06-05 | [13475](https://github.com/airbytehq/airbyte/pull/13475) | Scope `crm.objects.feedback_submissions.read` added for `feedback_submissions` stream |

0 commit comments

Comments
 (0)