core/modules/file/src/Entity/File.php | 7 ++----- core/modules/file/src/Tests/LinkTest.php | 9 ++++++++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/core/modules/file/src/Entity/File.php b/core/modules/file/src/Entity/File.php index c85a5e9..8133415 100644 --- a/core/modules/file/src/Entity/File.php +++ b/core/modules/file/src/Entity/File.php @@ -7,12 +7,10 @@ namespace Drupal\file\Entity; -use Drupal\Component\Utility\SafeMarkup; use Drupal\Core\Entity\ContentEntityBase; use Drupal\Core\Entity\EntityChangedTrait; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityTypeInterface; -use Drupal\Core\Entity\Exception\UndefinedLinkTemplateException; use Drupal\Core\Field\BaseFieldDefinition; use Drupal\Core\Url; use Drupal\file\FileInterface; @@ -289,9 +287,8 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { * {@inheritdoc} */ public function urlInfo($rel = 'canonical', array $options = []) { - // Core doesn't provide any link templates for files so let's build - // canonical url manually but allow contrib to provide link templates at - // some later time. + // Core does not provide any link templates for files so build the canonical + // URL manually, but allow contrib to provide link templates. if ($rel == 'canonical' && !$this->hasLinkTemplate('canonical')) { return Url::fromUri($this->url($rel, $options)); } diff --git a/core/modules/file/src/Tests/LinkTest.php b/core/modules/file/src/Tests/LinkTest.php index e480a50..03d8a10 100644 --- a/core/modules/file/src/Tests/LinkTest.php +++ b/core/modules/file/src/Tests/LinkTest.php @@ -1,6 +1,12 @@ link('', 'notcanonical'); $this->fail('Non-canonical link accepted'); - } catch (UndefinedLinkTemplateException $ex) { + } catch (UndefinedLinkTemplateException $e) { $this->pass('Non-canonical link rejected'); } } + }