WP Publication Archive
[resolved] Problem opening some files (8 posts)

  1. David Henry
    Posted 4 years ago #

    there are issues opening some files but I cannot work out what the issue is, all files are links to other websites and the links are fine.


    Do not work:


    The error is:

    Acrobat could not open 'file_name.pdf' because if is either not a supported file type of because the file has been damaged...

    As a quick fix is there a way to remove openfile and just have absolute links that open in a new window?



  2. Eric Mann
    Plugin Author

    Posted 4 years ago #

    Just so you know, we'll be dumping openfile.php entirely in the next version.

    For now, you can do a quick patch yourself to skip past it.

    First, open /lib/class.publication-markup.php and remove the following two lines (20-21):

    $this->uri = str_replace('http://', 'http|', $this->uri);
    $this->uri = str_replace('https://', 'https|', $this->uri);

    Then look for the get_the_link() function on line 104. Replace it with this:

    public function get_the_link() {
        return apply_filters( 'wpa-uri', $this->uri, $this->ID );
  3. David Henry
    Posted 4 years ago #

    Your a star!

    I've also added a target = blank to the link:)

  4. Eric Mann
    Plugin Author

    Posted 4 years ago #

    Forgot to recommend target=blank. The point of openfile.php was to force the link as a download (content-disposition=attachment) so that it wouldn't open in the same window. Without that, you'll need target=blank :)

  5. David Henry
    Posted 4 years ago #

    no problem, my client is even linking to their own posts which are considered documents in this context.

    Thanks for the plugin

  6. andybute
    Posted 4 years ago #

    Hi Eric,

    Could you post the complete code for this hack including the target=blank.


  7. Eric Mann
    Plugin Author

    Posted 4 years ago #

    @andybute I could, but at this time I am not going to. There are quite a few hacks floating around out there, and the majority of them will break pretty substantially when I release the next version. I'd rather not have any additional messiness make it into the wild.

    If you have an immediate need for some specific workaround to an issue, please open a new thread for that discussion and I'll see what I can work out.

  8. andybute
    Posted 4 years ago #

    The target=blank option of opening the document in a new window rather than forcing a save to disk is a much more user friendly and logical way of dealing with this issue in my opinion..
    I'll ask David Henry...

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP Publication Archive
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic