Skip to content

fix: do not crash in get_leaf_directories on single-component paths - #236

Open
Shriraj1901 wants to merge 1 commit into
adobe:mainfrom
Shriraj1901:fix/leaf-directories-relative-path
Open

Shriraj1901 wants to merge 1 commit into
adobe:mainfrom
Shriraj1901:fix/leaf-directories-relative-path

Conversation

@Shriraj1901

Copy link
Copy Markdown

get_leaf_directories() skipped hidden directories with root.split("/")[1].startswith("."), which raises IndexError whenever the walked root contains no "/". himl-config-merger therefore crashed for a relative source path such as "configs" or ".", and for Windows-style paths such as C:\configs, which os.walk() reports with backslashes.

Drop hidden directories from the os.walk() listing instead, so they are skipped (together with everything below them) regardless of how the source path is written.

Description

Brief description of the changes in this PR.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring
  • Performance improvement
  • Test improvement

Testing

  • Tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested the changes manually

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

Additional Notes

Add any additional notes, concerns, or context about the changes here.

get_leaf_directories() skipped hidden directories with
root.split("/")[1].startswith("."), which raises IndexError whenever the
walked root contains no "/". himl-config-merger therefore crashed for a
relative source path such as "configs" or ".", and for Windows-style
paths such as C:\configs, which os.walk() reports with backslashes.

Drop hidden directories from the os.walk() listing instead, so they are
skipped (together with everything below them) regardless of how the
source path is written.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant