Direct link to a file in a shared folder (webdav) not working properly?

my university is offering us access to a nextcloud server and I’m looking for an easy way to share files (direct link to download) with people in the same group as me.

The files I’d like to share are mounted inside NC via a webdav access to a server and I am trying to share this type of links: at the moment, I am using this type of link:

Our server is on NC12. This links are working fine if the user is already connected, but if there is no active session, the user is asked to login using a .htaccess popup and then gets the following error message :

Sans titre

If I refresh the page, after one or two refreshes, I finally get the file. It seems that as the login is not done using index.php/login, the webdav folders are not correctly mounted.

Based on what I have already found, I tried this type of link :

But it just redirects me to the homepage of my owncloud, without taking into account the redirect parameter.

Do you know if there is any option that would allow me to share this link? I tried using the “copy direct link” option (see below), the link will open the folder but what I’d like is a link that offers to download the file. Is this something that is doable?

Sans titre2