User without write permission can share a link with edit permission

I have user groups and a group folder that only provides write permission to one user group and share permission to all user groups. While logged in as a user with only share permission, I was not able to edit anything (including a md file) as expected, but I was able to create share links and select the option to provide edit permission as unexpected. I used the shared link as a non-registered user and was able to edit an md file.

I don’t think it should work like that. If a user does not have write permission in a folder, then they should not be able to create a share link with any permission relating to writing, editing or deleting. Can you please fix this?

Nextcloud version: 18.0.4
Host: Godaddy shared server
PHP version: 7.3.14

You should report this as a bug at GitHub.