• Resolved Texiwill

    (@texiwill)


    Hello,

    It appears the class-dlm-download-handler.php trigger logic is backwards for remote resources. It seems to want to download a chunk of the remote file instead of redirecting to the remote file. Perhaps I am missing something here. If I switch the code to:

    if ( $remote_file ) {
    
                            // Redirect - we can't track if this completes or not
                            $this->log( 'download', 'redirected', __( 'Redirected to remote file.', 'download-monitor' ), $download, $version );
    
                            header( 'Location: ' . $file_path );
    
                    } elseif ( $this->readfile_chunked( $file_path, $range ) ) {
    
                            // Complete!

    The remote files work as expected, otherwise they download a chunk of the data. Perhaps I am setting something incorrect but it does seem pretty basic to change Location for remote files and then do the chunked file for local files.

    –Edward

    https://www.ads-software.com/plugins/download-monitor/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello Edward,

    Our plugin is developed to support files uploaded using our plugin, on Amazon S3 or Google Drive. Remote files hosted anywhere else is not supported but if it works you are free to customize the plugin.
    If I misunderstood your question please do let me know.

    Thread Starter Texiwill

    (@texiwill)

    Hello,

    Is there a callback to call to redirect? I Personally did not see one. It would be very cool if a callback/action was available to bypass this as necessary. We use local files and remote files. The local files are the real issue. It was not clear.

    perhaps something like:

    // Trigger Actual Download Action
                    do_action( 'dlm_do_download', $download, $version, $file_path );
    
                    if ( $this->readfile_chunked( $file_path, $range ) ) {

    This way we can override the download code as required… A plugin allows me to override using my own plugin without modifying your code. While we can customize your code when we update we have to do it again…

    We could also override using the dlm_downloading action but it is not always called and before the file is accessed.

    Thoughts?
    Edward

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Remote Download Logic seems Backwards’ is closed to new replies.