Behaviour SwRS-MDOKFSTUDIO-TOOLBAR-094
A local link target must be a regular file inside the workspace
When a relative Markdown link is followed, the extension SHALL open its target only when the target is a regular file whose path and real path are below a workspace root, and block every other link with the reason of the first check that failed.
Step 4 of path 1 in StRS-MDOKFSTUDIO-TOOLBAR-011: from “The target is open” to “The file is open”.
Scenarios 4
The situations the tests check; open one to read it.
nominalA file below a root opens
| Input | Outcome |
|---|---|
| ../docs/target.md?view=1#heading from chapters/active.md, with docs/target.md below the root | opens the real path of the file with the suffix ?view=1#heading |
| a link that resolves below the second folder of a workspace of two folders | opens, because each root is tried before the link is blocked |
| a link to a symlink inside the workspace that points to a file inside the workspace | opens the real path of the file |
refusalA path outside every root
Givena link ../secret.md from a file at the root of the workspace
Whenit is resolved
Thenit is blocked with The navigation target is outside the workspace.
refusalA symbolic link out of the workspace
Givena link to a symlink inside the workspace that points to a file outside it
Whenthe link is resolved
Thenit is blocked with The navigation target escapes the workspace.
refusalA target that is missing or not a regular file
| Input | Outcome |
|---|---|
| a link to missing.md | blocked with The navigation target is unavailable. |
| a link to a folder | blocked with The navigation target is not a regular file. |