Skip to content

For users missing certain S3 permissions, files may be identified as directories #310

Open
@adrianohrl

Description

@adrianohrl

Depending on the machine in which the upload happens, downloading works fine. However, when a different machine tries to download the S3 remote path, it downloads files as directory.

from pathlib import Path

from cloudpathlib import CloudPath

CWD = Path.cwd()
TMP = Path(tempfile.gettempdir())

remote_path = CloudPath(f's3://test/models/')

local_path = CWD / 'models/'
remote_path.upload_from(local_path)

for rp in remote_path.iterdir():
    lp = local_path / rp.relative_to(remote_path)
    assert rp.is_file() == lp.is_file(), f'The {rp} remote path must be a file!'
    assert rp.is_dir() == lp.is_dir(), f'The {rp} remote path must be a directory!'

local_path = TMP / 'models'
remote_path.download_to(local_path)

for rp in remote_path.iterdir():
    lp = local_path / rp.relative_to(remote_path)
    assert rp.is_file() == lp.is_file(), f'The {lp} local path must be a file!'
    assert rp.is_dir() == lp.is_dir(), f'The {lp} local path must be a directory!'

Metadata

Metadata

Assignees

No one assigned

    Labels

    S3bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions