Skip to content

Commit 245a9cf

Browse files
committed
strip file:/// URLs
1 parent 19b8aba commit 245a9cf

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/utilities.jl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -517,11 +517,17 @@ end
517517
"""
518518
$(:SIGNATURES)
519519
520-
Get the URL (file and line number) where a method `m` is defined.
520+
Get the URL (file and line number) where a method `m` is defined. May return an empty string
521+
if the URL can not be determined.
521522
522-
Note that this is `Base.url`.
523+
Requires the `LibGit2` to be present in the environment.
523524
"""
524-
url(m::Method) = Base.url(m)
525+
function url(m::Method)
526+
# Base.url() something produces file:// URLs, but we want these to be sharable web URLs.
527+
# So we just say we couldn't determine the URL if we get one of those.
528+
url = Base.url(m)
529+
return startswith(url, "file://") ? "" : url
530+
end
525531

526532
# This is compat to make sure that we have ismutabletype available pre-1.7.
527533
# Implementation borrowed from JuliaLang/julia (MIT license).

0 commit comments

Comments
 (0)