Skip to content

fix(deploy-on-aws): check file extension before defusedxml dependency#132

Open
Sagargupta16 wants to merge 2 commits intoawslabs:mainfrom
Sagargupta16:fix/validate-drawio-early-exit
Open

fix(deploy-on-aws): check file extension before defusedxml dependency#132
Sagargupta16 wants to merge 2 commits intoawslabs:mainfrom
Sagargupta16:fix/validate-drawio-early-exit

Conversation

@Sagargupta16
Copy link
Copy Markdown

@Sagargupta16 Sagargupta16 commented Apr 15, 2026

Summary

  • Move the defusedxml dependency check after the file extension filter in validate-drawio.sh
  • Non-drawio files now exit early and silently instead of showing a dependency warning on every Edit/Write

Problem

The PostToolUse hook on Edit|Write runs validate-drawio.sh for every file write. The script checked for the defusedxml dependency before checking whether the file was a .drawio file, causing every non-drawio write (markdown, JSON, etc.) to emit:

Missing required dependency: defusedxml. Install it with: pip3 install defusedxml>=0.7.1

Fix

Reordered the script to:

  1. Read stdin and extract file path
  2. Check file extension (exit early for non-drawio files)
  3. Check defusedxml dependency (only reached for actual drawio files)

Related

Fixes #129

Changes

Reordered validate-drawio.sh to check file extension before checking the defusedxml dependency, so non-drawio file writes exit early and silently.

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.

Move the defusedxml dependency check after the file extension filter
so non-drawio files exit early and silently. Previously, every
Edit/Write hook invocation showed a "Missing required dependency"
warning even for unrelated files like markdown, JSON, etc.

Fixes awslabs#129
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Reorders validate-drawio.sh so non-.drawio file writes exit immediately, avoiding the noisy defusedxml missing-dependency warning on every Edit|Write hook invocation (fixes #129).

Changes:

  • Moves the defusedxml availability check to occur only after the .drawio / .drawio.xml extension filter passes.
  • Ensures non-drawio files exit early and silently before any dependency validation.

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.

deploy-on-aws: validate-drawio hook fires dependency warning on every file write, not just .drawio files

2 participants