JuliaWeb / URIs.jl

URI parsing in Julia
https://juliahub.com/docs/URIs
Other
26 stars 17 forks source link

StackOverflowError when mixing (uncarefully) isdir and uri #44

Closed o314 closed 2 years ago

o314 commented 2 years ago

Let's run

import URIs: URI
using Test

@testset begin
    u = URI(raw"c:\windows\temp") # on windows
    @test isdir(string(u))
    @test_throws StackOverflowError isdir(u)
end;

Those two tests pass. IMO, second one should not fail .

Because stat(path...) = stat(joinpath(path...)) implicitely expect a cast to string @ https://github.com/JuliaLang/julia/blob/v1.7.3/base/stat.jl#L193 meanwhile URIs return an URI when called on joinpath(::URI) and loops infinitely

Maybe should we add

Base.stat(a::URI) = stat(string(a))

That fixes that when calling isdir, isfile

o314 commented 2 years ago

This is not a very good bug report at this point. I have closed it for now.