Skip to content

Commit ba6804c

Browse files
authored
Merge pull request #854 from RS-PYTHON/feat-rspy544/invalid-catalog-download-links
Feat rspy544/invalid catalog download links
2 parents f77e5dc + f8cfa7b commit ba6804c

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

services/catalog/rs_server_catalog/user_catalog.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ def update_stac_item_publication( # pylint: disable=too-many-locals
406406
if not self.check_s3_key(item, asset, s3_key):
407407
# update the 'href' key with the download link
408408
new_href = f"https://{request.url.netloc}/catalog/\
409-
collections/{user}:{collection_id}/items/{fid}/download/{asset}"
409+
collections/{user}:{collection_id}/items/{self.request_ids['item_id']}/download/{asset}"
410410
content["assets"][asset].update({"href": new_href})
411411
# Update the S3 path to use the catalog bucket and create the alternate field
412412
new_s3_href = {"s3": {"href": s3_key}}
@@ -979,7 +979,7 @@ async def manage_get_response( # pylint: disable=too-many-locals, too-many-bran
979979
content = self.adapt_links(
980980
content,
981981
self.request_ids["owner_id"],
982-
self.request_ids["collection_ids"],
982+
self.request_ids["collection_ids"][0],
983983
"features",
984984
)
985985
elif request.scope["path"] == "/search":

services/staging/rs_server_staging/processors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,7 @@ def publish_rspy_feature(self, feature: Feature):
880880
try:
881881
response = requests.post(
882882
publish_url,
883-
headers={"cookie": self.headers.get("cookie", None)},
883+
headers={"cookie": self.headers.get("cookie", None), "host": self.headers.get("host", None)},
884884
data=feature.json(),
885885
timeout=10,
886886
)

services/staging/tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def staging(mocker):
136136
"""Fixture to mock the Staging object"""
137137
# Mock dependencies for Staging
138138
mock_credentials = mocker.Mock()
139-
mock_credentials.headers = {"cookie": "fake-cookie"}
139+
mock_credentials.headers = {"cookie": "fake-cookie", "host": "fake-host"}
140140
mock_input_collection = mocker.Mock()
141141
mock_collection = "test_collection"
142142
mock_item = "test_item"

services/staging/tests/test_rspy_processor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,7 @@ def test_publish_rspy_feature_success(self, mocker, staging_instance):
10901090
assert result is True # Should return True for successful publishing
10911091
mock_post.assert_called_once_with(
10921092
f"{staging_instance.catalog_url}/catalog/collections/{staging_instance.catalog_collection}/items",
1093-
headers={"cookie": "fake-cookie"},
1093+
headers={"cookie": "fake-cookie", "host": "fake-host"},
10941094
data=feature.json(),
10951095
timeout=10,
10961096
)
@@ -1119,7 +1119,7 @@ def test_publish_rspy_feature_fail(self, mocker, staging_instance):
11191119
assert result is False # Should return False for failure
11201120
mock_post.assert_called_once_with(
11211121
f"{staging_instance.catalog_url}/catalog/collections/{staging_instance.catalog_collection}/items",
1122-
headers={"cookie": "fake-cookie"},
1122+
headers={"cookie": "fake-cookie", "host": "fake-host"},
11231123
data=feature.json(),
11241124
timeout=10,
11251125
)

0 commit comments

Comments
 (0)