• Resolved cloudfactory

    (@cloudfactory)


    Hi,

    thanks for this nice plugin.

    However I seem to have a problem when displaying self-hosted PDFs.

    If I insert this shortcode :

    [flipbook pdf="https://mywbesite.com/content/uploads/2017/01/myfile.pdf"]

    on mywebsite.com, the generated src of the iframe becomes :

    https://flowpaper.com/flipbook/?pdf=https://mywebsite.com/content/uploads/2017/01/myfile.pdf?wp-hosted=1&title=&header=&theme=&thumbs=1&modified=1710151055

    which is not working (I get the “That does not seem to be a valid PDF url. Please check so the PDF exists.” error)

    If I replace manually the “?” before wp-hosted with an “&” in the URL, then it works perfectly :

    https://flowpaper.com/flipbook/?pdf=https://mywebsite.com/content/uploads/2017/01/myfile.pdf&wp-hosted=1&title=&header=&theme=&thumbs=1&modified=1710151055

    But the ?wp-hosted part is being added in the URL by your plugin (line 330 of file flowpaper.php)

    So I was wondering if I was doing something wrong ?

    Thanks for your help,

    Gianna

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author getflowpaper

    (@getflowpaper)

    You’re doing everything right – its something on your server that is preventing the file from being hosted from your wordpress uploads folder – easiest fix is just to upload it to a different folder (outside the wordpress installation) and you should be fine.

    Thread Starter cloudfactory

    (@cloudfactory)

    Thanks for your answer but I don’t get it, there’s nothing on my server that is preventing the file from being hosted from the uploads folder, the file has been uploaded successfully and is accessible.

    Or maybe you meant there’s something on *your* server that is preventing that ? In this case may I know why ?
    I would like this file to be uploaded by users in the back office so I need it to be in the uploads folder.

    Thanks again,

    Gianna

    Plugin Author getflowpaper

    (@getflowpaper)

    Could you share the full real url to the PDF with us so we can have a look? Feel free to send it to send it to [email protected] if you don’t want to post it here

    • This reply was modified 7 years, 5 months ago by getflowpaper.
    • This reply was modified 7 years, 5 months ago by getflowpaper.

    I have the same situation here.
    If I manually edit the flowpaper.php file in the plugin folder, everything works.
    The only thing I did is replace the question mark symbol ? on line 330 and line 332 with the ampersand symbol &.
    So line 330 changed from
    $pdfUrl = 'https://flowpaper.com/flipbook/?pdf=' . esc_attr( $value ) . (strpos(esc_attr($value),WP_CONTENT_URL)===0?"?wp-hosted=1":"");
    to
    $pdfUrl = 'https://flowpaper.com/flipbook/?pdf=' . esc_attr( $value ) . (strpos(esc_attr($value),WP_CONTENT_URL)===0?"&wp-hosted=1":"");
    and line 332 changed from
    $pdfUrl = 'https://flowpaper.com/flipbook/?pdf=' . esc_attr( $value ) . (strpos(esc_attr($value),WP_CONTENT_URL)===0?"?wp-hosted=1":"");
    to
    $pdfUrl = 'https://flowpaper.com/flipbook/?pdf=' . esc_attr( $value ) . (strpos(esc_attr($value),WP_CONTENT_URL)===0?"&wp-hosted=1":"");

    Any chance you can make the change upstream?

    Notice the structure of those lines. They create an HTTP query string with values for php variables to be passed to flowpaper. Such query strings have one question mark after the actual address of the php file being invoked. This question mark indicates the start of an array of variables in the form of variable=value separated by an ampersand & sign to form a URL that looks like https://example.com/script/?var1=foo&var2=bar&var3=foobar

    In the case of your plugin, you’re currently passing the question mark twice – the first time with the flowpaper.com/flipbook/?pdf variable at the start of lines 330 & 332, and the second time with the ?wp-hosted=1 variable at the end of those lines. So the final URL ends up looking like so:

    https://flowpaper.com/flipbook/?pdf=https://example.com/wp-content/uploads/2017/10/19/file.pdf?wp-hosted=1&title=Book&header=Author&theme=dark&thumbs=1

    This means that those values are not passed to flowpaper, but interpreted by it as part of the url, sending them to the pdf file and eventually returning an error to flowpaper.

    Changing the ? to an & before wp-hosted makes this variable and all the others after it be passed to flowpaper and understood by it.

    • This reply was modified 7 years, 5 months ago by somePaulo.
    Thread Starter cloudfactory

    (@cloudfactory)

    Thnaks @finomeno for the detailed explanation, this is exactly the problem I was trying to describe in my first post ??

    @getflowpaper, I have only just seen your answer. finomeno’s explanations should be enough, do you want me to send an email anyway ? I couldn’t explain it better than he did and I can’t send you the full real URL of the file because the website I’m working on is not online yet.

    For the moment I’m going to replace the ? with an & in the plugin source code manually, until you fix it upstream (I hope you will anyway!)

    Have a nice day,

    Gianna

    Issue not resolved yet. Fixes work, but plugin has still not been updated with correct code.

    Plugin Author getflowpaper

    (@getflowpaper)

    Hi there,
    It may look funny with 2 question marks in the url but it gets handled correctly once passed to the viewer (see example here: https://goo.gl/a7pHc3) so there must be something else that goes wrong once the url gets translated. Having 2 question marks is actually valid – the second question mark will be treated as a literal (see https://goo.gl/R1T7FL) and our scripts will handle it.

    Could you post a full url to where you have set this up?

    brianamar92

    (@brianamar92)

    I have same issue with wp-hosted=1, if I remove from following url , it starts working.
    But it is build in with plugin, so I can not remove it. Is there any workaround?

    https://flowpaper.com/online-pdf-viewer/?theme=dark&pdf=https://missioneurasia.5by5.work/content/uploads/2018/02/School-Without-Walls-Annual-Report-2017.pdf&wp-hosted=1&title=&header=&thumbs=1&modified=180226920

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Self-hosted PDF URL’ is closed to new replies.