Skip to content

fix: IpynbConverter.accepts() returns False instead of raising on non-decodable content#1910

Closed
wali-reheman wants to merge 1 commit into
microsoft:mainfrom
wali-reheman:fix/upstream-ipynb-accepts-unicode
Closed

fix: IpynbConverter.accepts() returns False instead of raising on non-decodable content#1910
wali-reheman wants to merge 1 commit into
microsoft:mainfrom
wali-reheman:fix/upstream-ipynb-accepts-unicode

Conversation

@wali-reheman
Copy link
Copy Markdown

Handles UnicodeDecodeError and ValueError gracefully in accepts() when a file with application/json mimetype can't be decoded as text — instead of crashing the full conversion pipeline, it just returns False so the converter skips the file.

Fixes #1894.

…-decodable content

Wraps decode in try/except to catch UnicodeDecodeError and ValueError
when a file with application/json mimetype contains non-notebook content
(e.g. a binary or non-ASCII file misidentified as JSON). This prevents
the converter from crashing the entire conversion pipeline when it
encounters files it should simply skip.

Fixes microsoft#1894
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.

bug: IpynbConverter.accepts() raises UnicodeDecodeError on non-ASCII files (French PDFs, etc.)

1 participant