Skip to content

fix: keep trailing-slash deobfuscation scoped - #186

Merged
junior-ricon merged 1 commit into
junior/deobfuscate-path-builtinsfrom
johnson/fix-deobfuscate-trailing-slash
Jul 28, 2026
Merged

fix: keep trailing-slash deobfuscation scoped#186
junior-ricon merged 1 commit into
junior/deobfuscate-path-builtinsfrom
johnson/fix-deobfuscate-trailing-slash

Conversation

@johnson-ricon

Copy link
Copy Markdown
Contributor

Finding

PR #185 replaces basename with ${arg##*/} for scoped deobfuscation. Unlike basename, that expansion returns an empty string for a path ending in /. Passing notes/<id>/ therefore leaves no non-empty scoped ID, selects full mode, and restores every note instead of only the requested note.

This fix removes trailing slashes before taking the final path component, using Bash 3.2-compatible parameter expansion. The regression proves only the selected note is restored and would fail on PR #185's exact head.

Validation

  • Regression on 8c91b5f902943a893b06bd1f48968a77d2478b06: failed as expected because all three notes were restored
  • mise run test test/deobfuscate.bats: 30 passed
  • mise run test: 415 BATS passed, 9 Python passed
  • codebase lint "$PWD": 8 rules passed
  • mise run doctor: required checks passed; optional clone-local pre-commit hook is not installed
  • readme build --check
  • bash -n .mise/tasks/deobfuscate lib/obfuscate.sh
  • git diff --check

Fix-it for #185. Base is junior/deobfuscate-path-builtins; this PR does not target main.

@junior-ricon
junior-ricon merged commit 9e8f779 into junior/deobfuscate-path-builtins Jul 28, 2026
2 checks passed
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