Skip to content

send_file throwing an error in werkzeug by passing a None-type to function that requires str #153

Closed
ymercad0/pathway
#15
@scoofy

Description

@scoofy

I upgraded to python 3.9 and i've run into some problems. When running:

mongo.send_file(filename)

Running tests, when I'm grabbing an image file from my mongo database, it seems to not be returning an MD5 in the fileobj, which causes an error here:

response.set_etag(fileobj.md5)

this seems to throw an error with werkzeug/http.py

line 850, in quote_etag
if '"' in etag:

TypeError: argument of type 'NoneType' is not iterable

I'm not exactly sure if this is the fault of flask-pymongo, or why i'm getting the error. But when i remove the set_etag line, it works just fine. The werkzeug file has a type hint that the etag must be a str, so it seems that you may want to turn a None instance into an empty string before running that function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions