Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changes/devel/13268.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed bug where the file_id is not set when the file contains a directory at the end of the file, by :newcontrib:`Théodore Papadopoulo`.
Comment thread
larsoner marked this conversation as resolved.
Outdated
2 changes: 1 addition & 1 deletion mne/_fiff/tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ def _read_dir_entry_struct(fid, tag, shape, rlims):
"""Read dir entry struct tag."""
pos = tag.pos + 16
entries = list()
for offset in range(1, tag.size // 16):
for offset in range(tag.size // 16):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looking at this for example I think this is probably correct

https://github.com/mne-tools/mne-cpp/blob/16a9381834d2c81269a553e0a1af7af752393006/src/libraries/fiff/fiff_tag.cpp#L565

So I'll go ahead and merge. Thanks @papadop !

ent = _read_tag_header(fid, pos + offset * 16)
# The position of the real tag on disk is stored in the "next" entry within the
# directory, so we need to overwrite ent.pos. For safety let's also overwrite
Expand Down