When clicking the Delete link in the file replace form, the following error is generated:

Drupal\Core\Entity\Exception\UndefinedLinkTemplateException: Cannot generate default URL because no link template 'canonical' or 'edit-form' was found for the 'file' entity type in Drupal\Core\Entity\EntityBase->toUrl()

D10.2.6, PHP 8.1.28

CommentFileSizeAuthor
#9 after_file.mp4237.54 KBatul_ghate
#9 before_file.mp43.73 MBatul_ghate
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

webfaqtory created an issue. See original summary.

webfaqtory’s picture

Issue summary: View changes
deepak5423’s picture

Hi @webfaqtory, Do we need the Delete button in replace file form page?
I think it is better to remove the option delete button from replace file form because we have an option to delete files from /admin/content/files.

webfaqtory’s picture

@deepak5423 I agree, it's not necessary on the replace file form and can be removed.

webfaqtory’s picture

I have discovered that this error is caused by the file_delete module not being installed. This should be a dependency in this modules installation

deepak5423’s picture

@webfaqtory I think it is better to add file_delete module as a dependency of the File Replace (D8+)

deepak5423’s picture

Status: Active » Needs review
atul_ghate’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new3.73 MB
new237.54 KB

I reviewed and applied the Merge Request. When we install the module via Composer with a dependency on the file delete module, the mentioned error will no longer appear, and we will be able to delete files successfully.

abramm’s picture

Confirming that enabling the file_delete module fixes an issue.

damienmckenna’s picture

Title: Delete does not work » File Delete module is required
Version: 8.x-1.3 » 8.x-1.x-dev