Skip to content

Conversation

@DealsBeam
Copy link

The case_insensitive_file_search function in legendary/lfs/wine_helpers.py did not correctly handle cases where the parent directory of the provided path does not exist. This could lead to the function returning an invalid path, which could cause errors in other parts of the application.

This commit fixes the issue by adding a check to ensure the parent directory exists before proceeding with the file search. If the parent directory does not exist, the function will now return None.

A new test case has been added to verify this fix.

The `case_insensitive_file_search` function in `legendary/lfs/wine_helpers.py`
did not correctly handle cases where the parent directory of the provided path
does not exist. This could lead to the function returning an invalid path,
which could cause errors in other parts of the application.

This commit fixes the issue by adding a check to ensure the parent
directory exists before proceeding with the file search. If the parent
directory does not exist, the function will now return `None`.

A new test case has been added to verify this fix.
@CommandMC
Copy link
Contributor

The function handles non-existent paths fine. Specifically, this will cause the function to short-circuit & just return the rest of the path as-is.

Returning None from a function annotated with -> str is incorrect. Any linter will warn you about this (AI may not)

I assume you've opened this PR because you're experiencing an issue. Please detail that issue (in an actual GH Issue), we can then look into the proper fix for it

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.

2 participants