Entity without canonical path gives 500

Created on 28 November 2024, 2 months ago

Problem/Motivation

When a canonical path is not defined for an entity type, it gives 500 error:
Drupal\Core\Entity\Exception\UndefinedLinkTemplateException: No link template 'canonical' found for the 'image_style' entity type in Drupal\Core\Entity\EntityBase->toUrl() (line 211 of /code/web/core/lib/Drupal/Core/Entity/EntityBase.php).

Steps to reproduce

Try to send path of an image style /router/translate-path?_format=json&path=%2Fsites%2Fdefault%2Ffiles%2Fstyles%2Fsmall%2Fpublic%2Fprofiles%xyz.jpg

Proposed resolution

Check if the entity has canonical path and log the call.

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇮🇳India sagar ramgade

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024