Commit 088043ff authored by Mathieu Coupé's avatar Mathieu Coupé Committed by Pierre Smeyers
Browse files

fix: sanitize user provided group path and print a warning

parent 88feccf9
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -212,6 +212,15 @@ def run() -> None:
    # retrieve root group
    try:
        group = butler.client.groups.get(butler.group_path)

        # check if group_path returned by API match group_path provided by user
        if butler.group_path != group.full_path:
            print(
                f"{AnsiColors.BLUE}Warning:{AnsiColors.RESET} provided group path {AnsiColors.BLUE}{butler.group_path}{AnsiColors.RESET} is not in canonical form (should be: {AnsiColors.BLUE}{group.full_path}{AnsiColors.RESET})"
            )
            # replace user provided group path with the API provided group path
            butler.group_path = group.full_path

    except GitlabGetError as ge:
        print(
            f"Src group {AnsiColors.BLUE}{butler.group_path}{AnsiColors.RESET}: get {AnsiColors.HRED}failed{AnsiColors.RESET}",