You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to diagnose an issue with path resolution if data-uri is set for network shares and UNC paths.
I provide a base_dir to Asciidoctor.js of: \\wnfs1\groups\prot_pai\_112_Files\8 Projects\KMO-TMI-OWH-TRK-protection-replacements-2021-2023\Vivian\Adoc
I receive error messages along the lines of:
{"resource": "/groups/prot_pai/_112_Files/8 Projects/KMO-TMI-OWH-TRK-protection-replacements-2021-2023/Vivian/Adoc/HAM_BZ_Coupler_Feeder_SS_15sep21-Stuart_comments.adoc","owner": "asciidoc","severity": 4,"message": "<stdin>: stylesheet does not exist or cannot be read: /wnfs1/groups/prot_pai/_112_Files/8 Projects/KMO-TMI-OWH-TRK-protection-replacements-2021-2023/Vivian/Adoc/assets/asciidoctor.css","source": "asciidoctor.js","startLineNumber": 1,"startColumn": 1,"endLineNumber": 1,"endColumn": 31}{"resource": "/groups/prot_pai/_112_Files/8 Projects/KMO-TMI-OWH-TRK-protection-replacements-2021-2023/Vivian/Adoc/HAM_BZ_Coupler_Feeder_SS_15sep21-Stuart_comments.adoc","owner": "asciidoc","severity": 4,"message": "image to embed not found or not readable: /wnfs1/groups/prot_pai/_112_Files/8 Projects/KMO-TMI-OWH-TRK-protection-replacements-2021-2023/Vivian/Adoc/SVG/HAM VT selection.png","source": "asciidoctor.js","startLineNumber": 1,"startColumn": 1,"endLineNumber": 1,"endColumn": 31}
What seems to be important is that it is reporting the path as having a single leading slash.
This occurs when normalize_system_path is called which calls below: start = $$$('::', 'File').$join(doc.$base_dir(), start)
Opal.def(self, '$normalize_system_path', $AbstractNode_normalize_system_path$32 = function $$normalize_system_path(target, start, jail, opts) {
var $a, self = this, doc = nil;
if (start == null) {
start = nil;
};
if (jail == null) {
jail = nil;
};
if (opts == null) {
opts = $hash2([], {});
};
if ($truthy($rb_lt((doc = self.document).$safe(), $$$($$($nesting, 'SafeMode'), 'SAFE')))) {
if ($truthy(start)) {
if ($truthy(doc.$path_resolver()['$root?'](start))) {
} else {
start = $$$('::', 'File').$join(doc.$base_dir(), start)
}
} else {
start = doc.$base_dir()
}
} else {
$join removes one of the leading / at the start of the filename.
This is destructive of UNC paths which is why Asciidoctor cannot resolve the image (and other resources) when data-uri is set.
We discussed this on Zulip and Dan helped me identify that this was part of Opal/Asciidoctor.js and there were tests for this situation in Asciidoctor Ruby.
The text was updated successfully, but these errors were encountered:
I think this fix needs to happen in Opal. File.$join needs to detect // at the start of the path and restore it after running path.join. By itself, path.join (or path.posix.join) normalizes the leading // to /.
I'm trying to diagnose an issue with path resolution if data-uri is set for network shares and UNC paths.
I provide a
base_dir
to Asciidoctor.js of:\\wnfs1\groups\prot_pai\_112_Files\8 Projects\KMO-TMI-OWH-TRK-protection-replacements-2021-2023\Vivian\Adoc
I receive error messages along the lines of:
What seems to be important is that it is reporting the path as having a single leading slash.
This occurs when
normalize_system_path
is called which calls below:start = $$$('::', 'File').$join(doc.$base_dir(), start)
$join
removes one of the leading/
at the start of the filename.Here are some outputs:
$join
is defined as:This assumes the path is a posix path and removes the leading
/
:This is destructive of UNC paths which is why Asciidoctor cannot resolve the image (and other resources) when
data-uri
is set.We discussed this on Zulip and Dan helped me identify that this was part of Opal/Asciidoctor.js and there were tests for this situation in Asciidoctor Ruby.
The text was updated successfully, but these errors were encountered: