No link template 'canonical' found for the 'file' entity type

Created on 7 March 2023, over 1 year ago
Updated 8 March 2023, over 1 year ago

Problem/Motivation

System generates an error

Drupal\Core\Entity\Exception\UndefinedLinkTemplateException: No link template 'canonical' found for the 'file' entity type in Drupal\Core\Entity\EntityBase->toUrl() (line 196 of core/lib/Drupal/Core/Entity/EntityBase.php).

Steps to reproduce

Create file and visit /file-dereference/{file_id}

Proposed resolution

Use $file->createFileUrl() instead of $file->toUrl()->toString();

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡΅πŸ‡±Poland alorenc Wolsztyn, πŸ‡΅πŸ‡±

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024