Skip to content

Open index files in binary mode when loading - #137

Open
Hashim1999164 wants to merge 1 commit into
spotify:mainfrom
Hashim1999164:fix/file-input-binary-mode
Open

Hashim1999164 wants to merge 1 commit into
spotify:mainfrom
Hashim1999164:fix/file-input-binary-mode

Conversation

@Hashim1999164

@Hashim1999164 Hashim1999164 commented Aug 22, 2026 •

Copy link
Copy Markdown

Summary

Fixes #97.

FileInputStream opened files with text mode fopen, which can rewrite bytes on Windows. That made Index.load(path) fail with a corrupt index error even though the same bytes loaded fine through a Python rb file object. Reads now use binary mode, matching FileOutputStream. Path based save also writes metadata and the index in a single pass instead of writing an index only file first.

Test plan

FileInputStream used fopen text mode, which can alter bytes on Windows and make Index.load(path) report a corrupt index while loading the same file via an rb file object works. Also save path indexes in one write so metadata is not dropped.

This branch has not been deployed

No deployments
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.

Index.load function exhibits unexpected behavior with filename:str argument

1 participant