Skip to content

Error for relpath on equal S3Paths #156

@bencottier

Description

@bencottier

MWE:

julia> using AWSS3, FilePathsBase

julia> dir = p"s3://some/dir/";

julia> relpath(dir, dir)
ERROR: ArgumentError: . cannot be parsed as S3Path{Nothing}
Stacktrace:
 [1] #parse#6
   @ ~/.julia/packages/FilePathsBase/qgXdE/src/path.jl:79 [inlined]
 [2] parse
   @ ~/.julia/packages/FilePathsBase/qgXdE/src/path.jl:78 [inlined]
 [3] relative(fp::S3Path{Nothing}, start::S3Path{Nothing})
   @ FilePathsBase ~/.julia/packages/FilePathsBase/qgXdE/src/path.jl:447
 [4] relpath(fp::S3Path{Nothing}, src::S3Path{Nothing})
   @ FilePathsBase ~/.julia/packages/FilePathsBase/qgXdE/src/aliases.jl:22
 [5] top-level scope
   @ REPL[54]:1

This is an odd thing to do directly. But it comes up if e.g. you are doing a walkpath(dir) where one of the files is directly in dir (call its path filepath). And then you want the relpath(dirname(filepath), dir).

I believe it doesn't work because this package will call tryparse(S3Path, ".") in this case and AWSS3 tryparse returns nothing if the path doesn't have the s3:// URI. So I'm not sure which package should be responsible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions