fix(trash): strip only trailing trash suffix in to_origin_dir_path - #2341
fix(trash): strip only trailing trash suffix in to_origin_dir_path#2341Siraryansingh wants to merge 3 commits into
Conversation
Fix to_origin_dir_path and to_origin_file_path so they strip only the trailing __bk and .bk suffix rather than splitting on all occurrences of __bk or .bk inside directory and file names. Fixes oscal-compass#2210 Signed-off-by: Aryan Singh <aryansingh.as1012@gmail.com>
|
@Siraryansingh Thx for this PR. Are you on our slack channel #oscal-compass-trestle-agileauthoring-c2p? To join you need a LF ID, you can get one here https://identity.linuxfoundation.org/. Below is Bob's review. Please fix the DCO and missing test issues, thx! ===== PR #2341 Review —
|
| Concern | Status |
|---|---|
| DCO signature mismatch | 🚫 Blocker |
| Logic correctness | ✅ Correct |
| Test for directory case | ✅ Present |
Test for file case with .bk in name |
|
| Code style | ✅ Fine |
The fix itself is correct and ready to merge once the DCO issue is resolved.
|
Also, some tips. Run locally: make develop |
|
Some additional recommendations:
|
What this PR does / why we need it:
Fixes
to_origin_dir_path()andto_origin_file_path()intrestle/common/trash.pyso they strip only the trailing__bkand.bksuffix instead of splitting on all occurrences of__bkor.bkinside directory and file names.Previously, directory names containing
__bk(e.g.alpha__bkbeta) were incorrectly truncated toalphaduring recovery.Which issue(s) this PR fixes:
Fixes #2210
How was this tested?:
test_to_origin_dir_path_with_bk_in_nameunit test intests/trestle/utils/trash_test.pypytest(17 passed in 0.04s)ruff(all checks passed)