diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php
index be15252..785ce8c 100644
--- a/wp-includes/post-template.php
+++ b/wp-includes/post-template.php
@@ -1462,6 +1462,10 @@ function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = fals
 	if ( trim( $link_text ) == '' )
 		$link_text = $_post->post_title;
 
+	if ( trim( $link_text ) == '' )
+		$parts = pathinfo( get_attached_file( $_post->ID ) );
+		$link_text = esc_html( $parts['filename'] );
+
 	/**
 	 * Filters a retrieved attachment page link.
 	 *
