• Resolved tillkrenz

    (@tillkrenz)


    Hi,

    I noticed that when I turn on protection for HTML files, their HTTP Content-Disposition is changed to “attachment”. This leads to the files being downloaded instead of displayed in the browser. The standard behavior of WordPress seems to be to return HTML media files “inline”. I think it would be best if the plug-in would maintain that standard behavior.

    if ( is_image( $file ) == false && is_pdf( $mimetype ) == false && is_video( $mimetype ) == false && is_audio( $mimetype ) == false ) {
    		$file_name = wp_basename( $file );
    		header( "Content-Disposition: attachment; filename=$file_name" );
    	}

    The above code snippet from ‘download.php’ could be updated to check if a file is an HTML file in order not to apply the change to the Content-Disposition.

    Thank you!

    • This topic was modified 2 years, 6 months ago by tillkrenz.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author BWPS Team

    (@buildwps)

    Hi @tillkrenz,

    Thanks for reaching out to us.

    We’ve done some quick tests just now but haven’t been able to reproduce the issue yet.

    Our protected HTML files still display on browsers.

    It shows Content-Disposition: inline under the response header (see our attached screenshot).

    So could you please send us a screencast showing the issue on your end?

    Which PDA version are you using, by the way?

    You might want to send these details to our support email – hello(at)preventdirectaccess.com so that our team can support you faster.

    Thread Starter tillkrenz

    (@tillkrenz)

    Hi,

    thank you so much for looking into this!

    I am on 2.8.2. I changed that snippet I quoted from the ‘download.php’ to “inline,” and that fixes it for my very limited use case. I would like to be able to update the plugin without losing this behavior though. The HTML files I am using are rather big (8-11 MB); maybe that makes a difference?

    Before making that change to the code, the HTTP response header showed Content-Disposition: attachment, [...]

    I am not able to make a screencast easily, please let me know if I can provide further details.

    Plugin Author BWPS Team

    (@buildwps)

    Hi @tillkrenz,

    Thanks for your information.

    We’ve tested with large-size HTML files as well. It’s working correctly there.

    Could you please send us the following information to our support email – hello(at)preventdirectaccess.com so that our team can support you faster & easier?

    1. A sample protected HTML file
    2. A sample logged-in account that has permission to view your protected file

    Thanks a lot, @tillkrenz.

    Plugin Author BWPS Team

    (@buildwps)

    This thread is closed due to no response from the author.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘HTML Media “Content-Disposition” is turned to “attachment”’ is closed to new replies.