Skip to content

Commit

Permalink
fix: add content type to metadata file
Browse files Browse the repository at this point in the history
  • Loading branch information
kaloster committed Jan 23, 2025
1 parent 0af3ef3 commit daa57df
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion ingestion_tools/scripts/common/fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ def _calc_etag(self, inputfile: str, partsize: int = 8388608) -> bytes:
def glob(self, *args: list[str]) -> list[str]:
return self.s3fs.glob(*args)

def open(self, path: str, mode: str, **kwargs) -> TextIOBase:
def open(self, path: str, mode: str, content_type: str = None, **kwargs) -> TextIOBase:
if content_type:
kwargs['ContentType'] = content_type
return self.s3fs.open(path, mode, **kwargs)

def localreadable(self, path: str) -> str:
Expand Down
2 changes: 1 addition & 1 deletion ingestion_tools/scripts/common/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class MergedMetadata(BaseMetadata):
def write_metadata(self, filename: str, merge_data: dict[str, Any]) -> None:
metadata = deep_merge(self.metadata, merge_data)
metadata = self.add_defaults(metadata)
with self.fs.open(filename, "w") as fh:
with self.fs.open(filename, "w", content_type="application/json") as fh:
fh.write(tojson(metadata))


Expand Down

0 comments on commit daa57df

Please sign in to comment.