Skip to content
Snippets Groups Projects
Commit 9fa8a881 authored by James Ennis's avatar James Ennis Committed by Jürg Billeter
Browse files

_yaml.py: Fix incorrect error message

This patch ensures that we receive an appropriate error
message if we specify an absolute path that leads within
the project.
parent c6306b88
No related branches found
No related tags found
1 merge request!956Fix warning when using an absolute path which exists inside the project
Pipeline #37291977 passed
......@@ -476,12 +476,18 @@ def node_get_project_path(node, key, project_dir, *,
is_inside = project_dir_path.resolve() in full_resolved_path.parents or (
full_resolved_path == project_dir_path)
if path.is_absolute() or not is_inside:
if not is_inside:
raise LoadError(LoadErrorReason.PROJ_PATH_INVALID,
"{}: Specified path '{}' must not lead outside of the "
"project directory"
.format(provenance, path_str))
if path.is_absolute():
raise LoadError(LoadErrorReason.PROJ_PATH_INVALID,
"{}: Absolute path: '{}' invalid.\n"
"Please specify a path relative to the project's root."
.format(provenance, path))
if full_resolved_path.is_socket() or (
full_resolved_path.is_fifo() or
full_resolved_path.is_block_device()):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment