summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2023-04-04 23:57:40 -0600
committerDan Allen <dan.j.allen@gmail.com>2023-04-05 04:28:44 -0600
commitf9c5f021c8c8cc935b28e7c4f53dc266d3622b1e (patch)
tree647211443ab93a13d304bae7bf1ee989d1765cee /lib
parent4de8ac36a64834ff4911bbaf3876ed82ab39c4a6 (diff)
make URL check in patched File.absolute_path? more robust
Diffstat (limited to 'lib')
-rw-r--r--lib/asciidoctor/pdf/ext/core/file.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/asciidoctor/pdf/ext/core/file.rb b/lib/asciidoctor/pdf/ext/core/file.rb
index 9f01f258..9f46397c 100644
--- a/lib/asciidoctor/pdf/ext/core/file.rb
+++ b/lib/asciidoctor/pdf/ext/core/file.rb
@@ -3,6 +3,6 @@
File.singleton_class.prepend (Module.new do
# NOTE: JRuby < 9.4 doesn't implement this method; JRuby 9.4 implements it incorrectly
def absolute_path? path
- (::Pathname.new path).absolute? && ((path.chr == '/' && File::SEPARATOR == '/') || !(URI.split path)[2])
+ (::Pathname.new path).absolute? && !(%r/\A[[:alpha:]][[:alnum:]\-+]*:\/\/\S/.match? path)
end
end) if RUBY_ENGINE == 'jruby'