Skip to content

Calling .suffix on a dir raises IndexError #120

@pjbull

Description

@pjbull

Path("/dir").suffix returns the empty string, and we should do the same.

S3Path("s3://bucket/dir").suffix results in:

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-21-161bf2e9d1ca> in <module>
----> 1 S3Path("s3://bucket/dir").suffix

~/miniconda3/envs/zamba-algorithms/lib/python3.6/site-packages/cloudpathlib/cloudpath.py in suffix(self)
    522     @property
    523     def suffix(self):
--> 524         return self._dispatch_to_path("suffix")
    525 
    526     @property

~/miniconda3/envs/zamba-algorithms/lib/python3.6/site-packages/cloudpathlib/cloudpath.py in _dispatch_to_path(self, func, *args, **kwargs)
    470 
    471         if isinstance(path_version, collections.abc.Sequence) and isinstance(
--> 472             path_version[0], PurePosixPath
    473         ):
    474             return [

IndexError: string index out of range

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions