Closed gms199 closed 3 years ago
Look like this is an issue in commit:
https://github.com/TwisterMc/pdfjs-viewer-shortcode/commit/084814438ec02cecc513c3358ae51cd98ac14fce
$file_name = str_replace( get_site_url(), '', $file_name );
will replace the site url as many times as it occurs in the file name. In the above instance, this removes "octavosystems.com" multiple times from $file_name. You might want to use preg_replace() instead which has an optional limit on the number of replacements performed.
I did not expect anyone to have their domain name in the URL twice. I've never seen that setup before. Is there a reason your site is setup this way?
I'll have to think up a work around as we're trying to fix a bigger issue by removing the domain name from the PDF URL.
I think the installation was originally configured to support multisite but I am not sure. Unfortunately it was done for us and I no longer have access to the person that set it up.
Right now we are commenting out the line the @erikwelsh pointed out. That appears to fix our issue..
Thanks for the support.
Ok, I'll look into just removing the first instance of the domain, hopefully that'll fix everyone's issues.
I updated the plugin to only remove the first instance of the domain. Give it a whirl.
Thanks @TwisterMc. I just checked my site and it appears to be having the same problem. I checked what get_site_url() is returning and it is actually this: https://octavosystems.com/octavosystems.com.
So I don't think it is the two occurrences but how the final URL is rebuilt. Let me know if you want me to test anything else out.
I have an idea that I'll try to get pushed up soon. Currently I'm removing the site_url as set in WordPress when I should probably just be figuring out the domain and removing that.
Ok, new version is up, hope it fixes the issue.
That looks like it fixed it! Thanks for the awesome support.
On Thu, Sep 3, 2020 at 9:40 PM Thomas McMahon notifications@github.com wrote:
Ok, new version is up, hope it fixes the issue.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/TwisterMc/pdfjs-viewer-shortcode/issues/8#issuecomment-686866092, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLNQO2EGU7P4IZH4L52PLTSEBHRZANCNFSM4QNEVR2A .
When updating the 1.5.2 the plugin is no longer loading the PDFs properly.
I am using this shortcode
[pdfjs-viewer url=https://octavosystems.com/octavosystems.com/wp-content/uploads/2020/04/OSD32MP1_BRK_SCH.pdf viewer_width=600px viewer_height=700px fullscreen=true download=true print=true]
I am getting this error message:
PDF.js v2.3.200 (build: 4ae3f9fc) Message: Missing PDF "https://octavosystems.com/wp-content/uploads/2020/04/OSD32MP1_BRK_SCH.pdf".
it looks like the URL path is being manipulated to pull out the second octavosystems.com in the correct URL.