Repository navigation
Conversation
Signed-off-by: Ankit Kumar <ankitkumar19473@gmail.com>
|
✅ DCO Check Passed Thanks @ankit2235, all your commits are properly signed off. 🎉 |
Merge Protections🟢 Merge protection satisfied — ready to merge. Show 1 satisfied protection🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
AI triage (advisory)Checked commit The PR makes ZIP input skip macOS metadata members: files under a top-level CI safety: no concern found. A maintainer must still approve CI. The |
There was a problem hiding this comment.
AI first review (advisory): blocker found
This review covers the full diff at 0df00701d9. It read the code and did not run it.
The main risk is an unhandled IndexError when a ZIP member has an empty filename and empty path parts. Check that path parts exist before index access, or use a membership check.
A maintainer makes the merge decision. This review never approves the pull request.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
dolfim-ibm
left a comment
There was a problem hiding this comment.
Thanks for the fix, we like this change: macOS-made ZIPs are a common input, and the new test reproduces the problem well.
One blocker before merge, plus two small follow-ups.
Blocker: a ZIP member named "" or "." now aborts the whole batch. For these names PurePosixPath(...).parts is (), so path.parts[0] raises IndexError. The error is raised outside the try/except around the member read, so it escapes convert_all() even with raises_on_error=False. On main, the same archive yields its other members plus a failure result for the bad entry. Details and a suggested fix are in the inline comment.
Follow-ups (non-blocking):
- A regression case for a member with an empty name would protect the fix.
._*is matched at any depth, so a real file such asdocs/._real.mdis now dropped silently. That is fine for AppleDouble files, but a_log.debugline per skipped member would make it traceable.
| settings of a folder as ``.DS_Store``. | ||
| """ | ||
| return ( | ||
| path.parts[0] == "__MACOSX" |
There was a problem hiding this comment.
path.parts is empty for a member named "" or ".", so this raises IndexError: tuple index out of range and aborts convert_all() even with raises_on_error=False.
The bot's "__MACOSX" in path.parts would also skip a legitimate nested a/__MACOSX/ folder. A slice keeps the top-level-only scope and is safe on empty parts:
| path.parts[0] == "__MACOSX" | |
| path.parts[:1] == ("__MACOSX",) |
There was a problem hiding this comment.
Thanks @dolfim-ibm! Fixed in the latest commit:
- Used
path.parts[:1] == ("__MACOSX",), so a member named""or"."no longer raises, and only the top-level__MACOSX/folder is skipped. - Added
test_member_with_an_empty_name_does_not_abort_the_batch. - Each skipped member is now logged at debug level.
Signed-off-by: Ankit Kumar <ankitkumar19473@gmail.com>
A ZIP made with macOS Finder ("Compress") also holds
__MACOSX/…/._<name>AppleDouble files and
.DS_Storefiles. ZIP input converted each of them as adocument:
.DS_Storefailed, soconvert_all()raisedConversionErrorby defaultand stopped the batch.
__MACOSX/docs/._notes.mdwas converted "successfully" from binarymetadata, which added a junk document to the results.
This change skips members under a top-level
__MACOSX/folder, members named._*, and.DS_Store. Other unsupported members still give a failure result,as before.
Tests: added
test_macos_archive_metadata_is_skipped. It fails onmainandpasses with this change. The existing ZIP tests pass unchanged.