Repository navigation
Potential bug: colab download can write invalid JSON #124
Closed
sridipbasu
started this conversation in
Show and tell
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Summary
While looking at the
colab downloadflow, I found that files returned withformat: "json"can be written as invalid JSON.The API returns the content as a decoded object, but the CLI currently uses
str(content). This writes Python's representation instead of valid JSON, which can make downloaded notebooks unreadable.Fix
I prepared a small fix using
json.dumps(content)forformat: "json"files, along with a regression test.I ran the full test suite and 346 tests pass. I also checked the new test against the old implementation, where it fails with
JSONDecodeError.The changes are available here:
View the changes
I haven't opened a PR because the current contribution guidelines say external PRs are not being accepted.
About contributing
I'm currently contributing to the Kaggle CLI as a triager/collaborator, where I've worked on a number of bug fixes and improvements. + I'm also an official Traige Collaborator assigned currently for the Kaggle CLI.
My Kaggle CLI contributions can be seen here:
View my Kaggle CLI PRs
I'd also be interested in actively contributing meaningful fixes to Colab CLI if there is a way for external contributors to get involved.
All reactions