Stopping WordPress media attachments comment spam

I just had my monthly look at the comments spam queue and was baffled by the amount of spam-comments on WordPress attachments. WordPress, surprisingly, has no option to disable comments on media, so based on information in this codex page about the comments_open function, I quickly assembled a plugin to stop comments on items in the media gallery altogether. The code (which can also be added in functions.php instead of going into a plugin):

<?php
/*
Plugin Name: No Media Comments
Author: Frank Goossens (futtta)
Plugin URI: http://blog.futtta.be/
Author URI: http://blog.futtta.be/
Description: Stop comments on media attachments
Version: 0.1
*/
add_filter( 'comments_open', 'noMediaComments', 10, 2 );
function noMediaComments( $open, $post_id ) {
$post = get_post( $post_id );
if ( 'attachment' == $post->post_type )
$open = false;
return $open;
}
?>

After throwing that at my server and seeing it worked, I realized there had to be a plugin for this and I indeed found Disable Comments and Comment Control in the wordpress.org plugin repository. Both plugins are by the same author and are only slightly different in scope really. So if you want to stop the comment spam on attached images on your WordPress blog, you’ve got several options. But shouldn’t this be tackled in WordPress core instead, really?