-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
blobs.contentType can be NULL #1351
Comments
We believe these nulls are created in two ways: when someone uploads a file using the API instead of a browser and when someone uses a browser that does not recognize geojson files (#489). The nulls are causing production servers that use S3 to crash. Fix 1 feels sufficient to me for a patch release. I think 3 is unacceptable because users may not have a way to fix the issue and the contenttype information is not that important. I'd like to propose doing 2 and also setting the mime types for files with geojson and cvs extensions based on extension. These are the two cases we know of where nulls have been introduced. There are suggestions for stronger validations and type determination at #489 (comment) and below but they don't feel worth the effort to me at this time. I don't feel like we need to do anything for blobs that already nave null contenttypes in the db beyond the fix 1 handling. |
Fix 1 sounds good as a patch release to me, too. We don't have to get into the messy details of blobs and content types, but it does stop breaking things. I was able to upload blobs with null content types through the API, and in doing so, noticed we don't have a lot of documentation for uploading attachments. I was actually struggling to explicitly set a content type on my attachment uploads. Forms don't seem to have anything about sending attachments: https://docs.getodk.org/central-api-form-management/#listing-form-attachments |
👍 I've added this to the description of #2 |
* s3: fix handling of NULL blob.contentType values Ref #1351
Set blob."contentType" values to application/octet-stream if no mime type is supplied on upload. Related: getodk#1351
NOT NULL
constraint on theblobs.contentType
column, i.e. column isNULLABLE
NULL
values are turning up in production instancesnull
values forBlob
frames throw in s3 code:TypeError: response header response-content-type should be of type "string"
Related
Issues
PRs
Potential fixes
continue to allowNULL
values, but handle these in s3 code (s3: fix handling of NULL blob.contentType values #1353)blobs."contentType"
in the db, e.g.application/octet-stream
; try to guess content type from file extension if no contentType is provided on uploadnull
contentType values when trying to insert values in the dbcontentType
value for blobs withNULL
values in dbThe text was updated successfully, but these errors were encountered: