Corrupted BlobMedia raises an exception at a weird location

If you pass None as the second argument of BlobMedia it successfully creates an object but that object will raise TypeError: 'NoneType' has no length whenever it is used. This creates some trippy experiences trying to track down the TypeError.

For example:

img = BlobMedia("image/png", None) # executes successfully
print(img) # raises the TypeError

The expected behavior is that if the BlobMedia constructor recieves invalid input it is the constructor that throws the exception not the __repr__ or __str__.

Resolved with https://github.com/anvil-works/anvil-runtime/pull/12

Moved to Bug Reports, and I’ve reviewed your PR. I think you’re about to get bragging rights for being the first external contributor to the Anvil Runtime!

3 Likes