commit 52ceb062e00c9264083a9e215cfaa3c4f07fed4e
Author: Bart Feenstra <bart@mynameisbart.com>
Date:   Tue Jan 14 10:09:10 2014 +0100

    foo

diff --git a/core/modules/file/lib/Drupal/file/Entity/File.php b/core/modules/file/lib/Drupal/file/Entity/File.php
index 816435b..f6616b9 100644
--- a/core/modules/file/lib/Drupal/file/Entity/File.php
+++ b/core/modules/file/lib/Drupal/file/Entity/File.php
@@ -21,6 +21,7 @@
  *   id = "file",
  *   label = @Translation("File"),
  *   controllers = {
+ *     "access" = "Drupal\file\FileAccessController",
  *     "storage" = "Drupal\file\FileStorageController",
  *     "view_builder" = "Drupal\Core\Entity\EntityViewBuilder"
  *   },
diff --git a/core/modules/file/lib/Drupal/file/FileAccessController.php b/core/modules/file/lib/Drupal/file/FileAccessController.php
new file mode 100644
index 0000000..87267d4
--- /dev/null
+++ b/core/modules/file/lib/Drupal/file/FileAccessController.php
@@ -0,0 +1,34 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\file\FileAccessController
+ */
+
+namespace Drupal\file;
+
+use Drupal\Core\Entity\EntityAccessController;
+use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Session\AccountInterface;
+
+/**
+ * Access controller for the file entity.
+ *
+ * @see \Drupal\file\Entity\File.
+ */
+class FileAccessController extends EntityAccessController {
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function checkAccess(EntityInterface $entity, $operation, $langcode, AccountInterface $account) {
+    /** @var \Drupal\file\FileInterface $entity */
+    if (($operation == 'view') && (file_uri_scheme($entity->getFileUri()) == 'public')) {
+      return TRUE;
+    }
+    else {
+      return parent::checkAccess($entity, $operation, $langcode, $account);
+    }
+  }
+
+}
diff --git a/core/modules/rest/lib/Drupal/rest/Tests/FileTest.php b/core/modules/rest/lib/Drupal/rest/Tests/FileTest.php
new file mode 100644
index 0000000..46ad058
--- /dev/null
+++ b/core/modules/rest/lib/Drupal/rest/Tests/FileTest.php
@@ -0,0 +1,62 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\rest\Tests\FileTest.
+ */
+
+namespace Drupal\rest\Tests;
+
+/**
+ * Tests resource read operations on files.
+ */
+class FileTest extends RESTTestBase {
+
+  /**
+   * Modules to enable.
+   *
+   * @var array
+   */
+  public static $modules = array('rest', 'hal', 'file');
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function getInfo() {
+    return array(
+      'name' => 'File resource',
+      'description' => 'Test special cases for file entities.',
+      'group' => 'REST',
+    );
+  }
+
+  /**
+   * Enables file specific REST API configuration and authentication.
+   *
+   * @param string $method
+   *   The HTTP method to be tested.
+   * @param string $operation
+   *   The operation, one of 'view', 'create', 'update' or 'delete'.
+   */
+  protected function enableFileConfiguration($method, $operation) {
+    $this->enableService('entity:file', $method);
+    $permissions = $this->entityPermissions('file', $operation);
+    $permissions[] = 'restful ' . strtolower($method) . ' entity:file';
+    $account = $this->drupalCreateUser($permissions);
+    $this->drupalLogin($account);
+  }
+
+  /**
+   * Tests access to REST resources of public files.
+   */
+  public function testFiles() {
+    $this->enableFileConfiguration('GET', 'view');
+    /** @var \Drupal\file\FileInterface $file */
+    $file = $this->entityCreate('file');
+    $file->setFileUri('public://');
+    $file->save();
+    $this->httpRequest('entity/file/' . $file->id(), 'GET', NULL, $this->defaultMimeType);
+    $this->assertResponse(200);
+  }
+
+}
