Hi there,
I guess I’ve found a problem in your code, regarding JavaScript redirect after downloading single file from files package.
The problem exists in line 347
of class.FileList.php
where you add a <script>
tag with click event for the Download button.
Let’s take a look at your piece of code:
jQuery('.inddl').click(function() {
var tis = this;
jQuery.post('https://someexampleurl.com', {
wpdmfileid: '1234',
wpdmfile: jQuery(this).attr('file'),
actioninddlpvr: 1,
filepass: jQuery(jQuery(this).attr('pass')).val()
}, function(res) {
res = res.split('|');
var ret = res[1];
if (ret == 'error')
jQuery(jQuery(tis).attr('pass')).addClass('input-error');
if (ret == 'ok')
location.href = jQuery(tis).attr('rel') + '&_wpdmkey=' + res[2];
});
});
This is the piece of code that contains an issue:
if (ret == 'ok')
location.href = jQuery(tis).attr('rel') + '&_wpdmkey=' + res[2];
jQuery(tis).attr('rel')
takes rel
attribute value and appends it to current url, so if my package is at https://someexampleurl.com/download/package
and I click the download button which has rel="nofollow"
attribute, I am redirected to:
https://someexampleurl.com/download/package/nofollow&_wpdmkey=WPDMKEY
which gives me a 404 page.
As you can see, ?rel=
is missing in your code where you override location.href
and that redirects to non existing page. You don’t even check whether there is any query variable in the URL or not, which may lead to something like this: https://someexampleurl.com/&_wpdmkey=WPDMKEY
.
Also, if you try to download the file while being connected to slow network, it doesn’t fire the save file dialog
everytime, redirect is fired earlier instead.
I will fix it on my own, but future update will override my fixes. That’s why I’m posting the issue here. I hope you will fix it as soon as possible.
Hi
I’m new with wpdownloadmanager (Former Joomla developer and use to use DOCman). In DOCman you can get a list view with all documents that can be downloaded (see http://www.ekvstolar.se/ladda-ner).
But how do I do that in WPDM???
I have followed the instruction here https://www.wpdownloadmanager.com/doc/settings/basic-settings/ and change the base url (https://imgur.com/reY6jAd) but it doesn’t work: http://195.238.77.215/~kavlingelarcen/laddaner/instruktioner
What’s wrong?
After updating the download manager the filenames changed. after downloading a file the wpdml changes the original filename and adds the url in front of it. how can i change this