• Resolved SJNBham

    (@sjnbham)


    The download links created are in the format of https://mydomain.com/news/downloads/62211898b6a67. When we try clicking the download button, the browser either gives an “ERR_INVALID_RESPONSE” or pulls up a “blank” page on our website. We thought maybe this was related to our Permalink Settings, but are unsure how that would affect this plugin. We’re using “/news/%year%/%postname%” for our custom permalink settings. Do you know what might be going on here and what the download link format should look like?

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter SJNBham

    (@sjnbham)

    In digging into the directory structure, it looks like the downloads are being stored in:

    https://mydomain.com/wp-content/uploads/jabd-downloads/8/62211898b6a67.zip

    When we access it using the above link directly in a browser, the download succeeds. We’re unsure why our download button link is referencing “/news/downloads/62211898b6a67”.

    Plugin Author janwyl

    (@janwyl)

    Hi thanks for flagging this with me. Yes I can recreate the problem so will look into it and get back to you – will be tomorrow now I’m afraid but hopefully will have something for you then…

    Plugin Author janwyl

    (@janwyl)

    OK so I know that last night I managed to reproduce the issue once on a clean install. And now I can’t reproduce it on the same install. Seems to work fine whatever permalink structure I use.

    Have you already tried refreshing permalinks by going to Settings > Permalinks and hitting “Save changes”?

    (Would be nice if it’s that simple…)

    Thread Starter SJNBham

    (@sjnbham)

    Refreshing the permalink settings didn’t appear to resolve the issue for us. Try creating a small download (10MB and then a large download (700 MB). See if that makes any difference in your results.

    We seem to be able to create small downloads reliably and the Download button works for them. But the larger download links don’t seem to work. We’ve tried giving it time in case there was some kind of backend process going on. We can download the zip file directly after creating it if we manually enter the URL – even if the download link isn’t working (e.g. https://mydomain.com/wp-content/uploads/jabd-downloads/8/622254e9d848c.zip works immediately when https://mydomain.com/news/downloads/622254e9d848c doesn’t).

    Also, for Edge (Chromium) we’re getting HTTP error 500 for the download links that aren’t working. For the same URL in Firefox, we’re getting HTTP error 404. Not sure why the browsers are handling them differently.

    Plugin Author janwyl

    (@janwyl)

    Well that all seems pretty weird and to be honest I’m not sure we’ll get to the bottom of what’s causing the problem.

    But since we know that a link direct to the file in the uploads folder works then I suggest trying this in your functions.php file, which amends the download button link directly:

    
    add_filter( 'post_type_link', 'my_theme_amend_bulk_download_url', 10, 2  );
    function my_theme_amend_bulk_download_url( $post_link, $post ) {
    	if ( class_exists( 'Bulk_Attachment_Download_Manager' ) ) {
    		if ( 'jabd_download' == $post->post_type ) {
    			if ( current_user_can( 'edit_post', $post->ID ) ) {
    				$uploads_dir_info = wp_upload_dir();
    				$post_link = $uploads_dir_info['baseurl'] . '/' . JABD_DOWNLOADS_DIR . '/' . get_post_meta( $post->ID, 'jabd_path', true );
    			}
    		}
    	}
    	return $post_link;
    }
    

    Hopefully that will work for you – let me know…

    Thread Starter SJNBham

    (@sjnbham)

    That seems to fix the download button link. Not sure what the root cause of the issue is, but thank you for the workaround. Maybe if others run into this there could be some correlation and the cause will be discovered.

    Appreciate the quick response!

    Plugin Author janwyl

    (@janwyl)

    OK great glad it’s working for you ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Download link not working’ is closed to new replies.