Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(download): handle sub-directories #135

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crunch/api/domain/data_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def __repr__(self):
@dataclasses.dataclass(frozen=True)
class DataFile:

name: str
url: str
size: int
signed: bool
Expand Down
6 changes: 3 additions & 3 deletions crunch/command/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
@dataclasses.dataclass
class DataFile:

url: str
path: str
url: str
size: int
signed: bool

Expand Down Expand Up @@ -53,12 +53,12 @@ def get_file(data_file: api.DataFile) -> DataFile:
url = data_file.url
path = os.path.join(
data_directory,
utils.get_name(url)
data_file.name
)

return DataFile(
url,
path,
url,
data_file.size,
data_file.signed
)
Expand Down
6 changes: 0 additions & 6 deletions crunch/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,12 +288,6 @@ def get_extension(url: str):
raise click.Abort()


def get_name(url: str):
url = cut_url(url)

return os.path.basename(url)


def _download_head(
session: requests.Session,
url: str,
Expand Down
Loading