Skip to content

Commit

Permalink
Merge pull request #330 from nextstrain/zstd-encoding
Browse files Browse the repository at this point in the history
remote: Add zstd to encoding types
  • Loading branch information
joverlee521 authored Nov 16, 2023
2 parents 4dc06eb + a702c89 commit 91b8423
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions nextstrain/cli/remote/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@
mimetypes.add_type("application/json", ".json")
mimetypes.add_type("text/markdown", ".md")

# Add zstd to encodings map since it is not yet included in the standard library
mimetypes.encodings_map[".zst"] = "zstd"


def upload(url: urllib.parse.ParseResult, local_files: List[Path], dry_run: bool = False) -> Iterable[Tuple[Path, str]]:
"""
Expand Down Expand Up @@ -281,6 +284,9 @@ def guess_type(path: Path) -> Tuple[str, Optional[str]]:
>>> guess_type(Path("metadata.tsv.xz"))
('text/tab-separated-values', 'application/x-xz')
>>> guess_type(Path("metadata.tsv.zst"))
('text/tab-separated-values', 'application/zstd')
>>> guess_type(Path("metadata.tsv.Z"))
('text/tab-separated-values', 'application/octet-stream')
Expand All @@ -292,6 +298,7 @@ def guess_type(path: Path) -> Tuple[str, Optional[str]]:
"gzip": "application/gzip",
"xz": "application/x-xz",
"bzip2": "application/x-bzip2",
"zstd": "application/zstd",
}

type, encoding = mimetypes.guess_type(path.name)
Expand Down

0 comments on commit 91b8423

Please sign in to comment.