Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions shared/yaml/codeql/yaml/Yaml.qll
Original file line number Diff line number Diff line change
Expand Up @@ -424,14 +424,24 @@ module Make<InputSig Input> {
* Gets the absolute path of the file included by this directive.
*/
private string getTargetPath() {
exists(string path | path = this.getValue() |
if path.matches("/%")
then result = path
else
result =
this.getDocument().getLocation().getFile().getParentContainer().getAbsolutePath() + "/" +
path
)
result = this.getAbsolutePath()
or
result =
this.getDocument().getLocation().getFile().getParentContainer().getAbsolutePath() + "/" +
this.getRelativePath()
}

/** Join-order helper for `getTargetPath`. Gets the path but only if it is an absolute path. */
private string getAbsolutePath() {
result = this.getValue() and
result.matches("/%")
}

/** Join-order helper for `getTargetPath`. Gets the path, but only if it is a relative path. */
pragma[noinline]
private string getRelativePath() {
result = this.getValue() and
not result.matches("/%")
}
}

Expand Down
Loading