Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix input validation for directories and handle unreachable function in JSON checks #4035

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

aayushkdev
Copy link
Contributor

@aayushkdev aayushkdev commented Dec 22, 2024

Fixes #3592

When the --from-json option is used, it currently allows directories as input, resulting in a crash. This issue was initially addressed in PR #3609, but the fix did not fully resolve the problem. As a result, the tool continues to crash when directories are passed to --from-json.
This PR aims to resolve the issue by adding validation checks for directories.

It also fixes unreachable if statements in the validate_input_path function, ensuring more accurate validation of input files. Additionally, it ensures that files without the .json extension or those containing invalid JSON are correctly flagged, improving error handling and overall input validation.

Tasks

  • Reviewed contribution guidelines
  • PR is descriptively titled 📑 and links the original issue above 🔗
  • Tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR
    Run tests locally to check for errors.
  • Commits are in uniquely-named feature branch and has no merge conflicts 📁
  • Updated documentation pages (if applicable)
  • Updated CHANGELOG.rst (if applicable)

… in JSON checks

Signed-off-by: Aayush Kumar <aayush214.kumar@gmail.com>
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.

scancode crash when using directory with --from-json
1 participant