akeeba / release-system

[INTERNAL PROJECT] Akeeba Release System
35 stars 26 forks source link

Show unauthorised links option downloads the link #220

Closed laoneo closed 1 year ago

laoneo commented 1 year ago

I'm testing the "Show unauthorised links" feature which is actually really nice.

When I enable "Show unauthorised links" on an item and define a link. Then the page of this link is downloaded in the browser when the visitor clicks on the download link of the item. Should the visitor not be redirected to that link instead?

nikosdion commented 1 year ago

It should be a redirection, not a download. I think that there's probably a logic inversion in the download() method. Do you want to take a look at it? I and sick, again (yay, having school age children…) and won't be able to debug anything for a few days…

laoneo commented 1 year ago

Yes I will have a look, just wanted to confirm that I do not miss something, before I start to dig into the issue.

laoneo commented 1 year ago

The problem is that download is always added to the link as you can see here https://github.com/akeeba/release-system/blob/development/component/frontend/tmpl/items/item.php#L40. In my override I'v replaced the line with <?php echo $directLink ? 'download' : ''; ?>. Then the download attribute is only added when a direct link exists. Would that be the solution?

nikosdion commented 1 year ago

Ah, yes, that makes sense. I don't use unauthorised links and never caught that. I'll make that change.

laoneo commented 1 year ago

I guess you have to apply the change here https://github.com/akeeba/release-system/blob/development/component/frontend/tmpl/items/item.php#L187 and here https://github.com/akeeba/release-system/blob/development/component/frontend/tmpl/items/item.php#L56 as well.

nikosdion commented 1 year ago

There were another two places. I came up with an even better solution which also works if the item doesn't have a DirectLink e.g. documentation ePub and PDF files.

laoneo commented 1 year ago

Nice!