lbryio / spee.ch

An image hosting service on top of the LBRY protocol.
https://spee.ch
MIT License
186 stars 77 forks source link

Move media type strings to constants and use a content type lookup util #882

Closed jessopb closed 5 years ago

jessopb commented 5 years ago

The code is littered with tests for 'image/gif', or determinetype() or extension for 'type/ext'. Adding a new type support involves editing many files consistently. This should be centralized.

kauffj commented 5 years ago

I endorse cleaning this up on the path to filtering and/or as you're adding support for more types.

It seems decently likely that we'll want a file to carry around both it's media type and a higher-level category (like "image", "text" as you say).

If we need content-specific file size limit, I'd guess that category-based would be sufficient. However, if this adds any substantial complexity, I think a single global limit is fine.