Missing error page for internal link in case of insuffienct permissions

System Information
Nextcloud version: 26.0
Operating system and version : docker
Apache or nginx version : Apache 2.4.54
PHP version: 8.1

I have a couple of documents in my folder. If I share a document with user B and send him the internal link he can access the file and everything is okay.
If I send the link to user C, who does not have the permissions to access the file, this person does not see any error page, notification or anything else. Instead user C gets redirected to his home screen/dashboard.

Is this the intended behaviour or is there a way to configure an error page like “You do not have the permissions to access this file”?