Unacceptable file formats

Posted under General

Danbooru is not the place for text and html hosting, though they sometimes (usually accidently) get uploaded and then flagged for deletion (e.g. post #169663, and post #169660). Why don't we have a feature where the upload script checks the file extension against a blacklist of bad extensions and throw up a friendly error in that case.

It would benefit both the user uploading (since they would know something was wrong, be able to fix it, and not have to deal with extra deleted files on their record), and the users browsing, since nobody really wants random text files in their search results. We could also add uncompressed bitmaps to the list since those are also typically frowned upon with a message telling them that they can convert the BMP to PNG and re-upload if they like.

Is this a good idea?

Updated by LaC

Fencedude said:
I don't see why Danbooru doesn't automatically reject everything but JPG, PNG and Flash files.

This seems like a bad idea because it'd be a pain if there was some sort of new format. Hell, you've already missed GIF in your list. That's probably why it's like this now.

Better to reject content-type that we know is bad than to accept only content we know is good.

surasshu said:
This seems like a bad idea because it'd be a pain if there was some sort of new format. Hell, you've already missed GIF in your list. That's probably why it's like this now.

Better to reject content-type that we know is bad than to accept only content we know is good.

Really, though, how often does a new image format come along? Adding a format to the list every few years doesn't seem like it would be a big issue.

Besides, there are thousands and thousands of unacceptable file types, and maybe half a dozen good ones. I know which list I'd rather maintain.

thubba said:
Really, though, how often does a new image format come along?

That's actually precisely why you shouldn't ban all non-danbooru-standard formats. The reason futureproofing your software is essential is because if ten years down the line a new format appears I guarantee that adding a new format will be a big issue.

Besides the way it currently is you could think of ingenious solutions to problems. For example, you could upload a zip file that has a 100+ page doujinshi, and child it below the cover.

I really don't see the benefit of only allowing PNG/JPG/GIF. There's only a few filetypes that ever cause problems (I can think of maybe 3).

LaC said:
The content-type should be checked, instead of the extension.

If we do it this way, we'll also have to make sure the system is smart enough to rename miss-matching extensions, or we'll still run into problems.

Fencedude said:
I don't see why Danbooru doesn't automatically reject everything but JPG, PNG and Flash files.

We *could* whitelist instead of blacklist, but while I'm pretty sure {jpg, png, gif, swf} are the only files we'll be dealing with, and only the first three of those thumbnail properly, as surasshu says there are probably instances where other formats might be acceptable in the future. Take the case of MP3's. While they aren't common, and it's not clear if they're supposed to be allowed, they are in the database, and have been accepted in the past.

surasshu said: The reason futureproofing your software is essential is because if ten years down the line a new format appears I guarantee that adding a new format will be a big issue.

It won't. You just post and say "Hey albert, add this to the list", and he does, and we all go on our merry way.

But whatever, images in the wrong format are rare, and easy enough to delete.

1