Link to PDF wrong  


dlinstedt
Posts: 4
Customer
(@dlinstedt)
Member
Joined: 1 year ago

To whom it may concern:  A few weeks ago I got a message for a PDF attachment that my forum has.  I just looked into the problem, and the issue is:

Advanced Attachments is interpreting the "shortcode" in the wpForo Post as follows:

https://datavaultalliance.com/datavaultalliance.com/wp-content/uploads/wpforo/attachments/1/13-DVModelingSpecs202.pdf

It's adding the domain TWICE to the URL.  This is a problem for me.

Do you think it's the .htaccess code?  (posted below)

OR is it just the Advanced Attachments code not working properly?

# This file was updated by Duplicator Pro on 2019-02-07 03:34:01.
# See htaccess.orig for the .htaccess original file.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# Prevent Direct Access Rewrite Rules
RewriteRule ^pda/([a-zA-Z0-9-_.]+)$ index.php?pda_v3_pf=$1&pdav3_rexypo=ymerexy [L]
RewriteCond %{HTTP_USER_AGENT} !facebookexternalhit/[0-9]
RewriteCond %{HTTP_USER_AGENT} !Twitterbot/[0-9]
RewriteCond %{HTTP_USER_AGENT} !Googlebot/[0-9]
RewriteRule ^wp-content/uploads(/_pda/.*\.\w+)$ index.php?pda_v3_pf=$1 [QSA,L]
# Prevent Direct Access Rewrite Rules End

# IP Block Rewrite Rules for Folder Protection
RewriteRule ^wp-content/uploads(/(wpforo)/.*\.\w+)$ index.php?pda_v3_pf=$1 [QSA,L]
# IP Block Rewrite Rules for Folder Protection End

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
# Wordfence WAF
<Files ".user.ini">
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
</Files>
# END Wordfence WAF

3 Replies
Astghik
Posts: 3475
Admin
(@astghik)
Support Team
Joined: 2 years ago

Hi @dlinstedt,

OR is it just the Advanced Attachments code not working properly?

We've check this and everything is working fine on all test websites.  You can check it here to make sure: https://addons.wpforo.com/community/wpforo-advanced-attachments/

Do you think it's the .htaccess code?  (posted below)

Yes, I think something is wrong with your website configurations but I could not say exactly what.  

Reply
dlinstedt
Posts: 4
Customer
(@dlinstedt)
Member
Joined: 1 year ago

Agreed!  You guys rock, your code is clean and solid.  Thank you for such an incredibly wonderful product.  I really appreciate it, as forum software & attachments go - it's not easy at all to make things work properly.

I am researching this further, and I believe? it may have to do with either Elementor or Astra themes, which probably "prefixes" HREF links that it finds are "headless"  (without https or https prefixes).

Turns out, as soon as I added the "https:" prefix back to the $fileurl in wpForoAttachmentsTools.php (inserted a new line 104 just to test), that the problem disappeared.  I believe, it has to do with Elementor automatically "completing href" to fully qualified that don't have a header prefix on them.

So my question is:

1) Can you "add a settings switch in the admin control panel for wpForoAdvanced Attachments" that says: "force prepend with https/http (server prefix)"??

2) let me turn it on / off in the admin panel?

I think, this will fix it for themes like Elementor that "go above and beyond" to make sure no HREF URLS are left hanging.

Reply
dlinstedt
Posts: 4
Customer
(@dlinstedt)
Member
Joined: 1 year ago

I ran another test (just now), and it in fact IS Elementor Theme - "coming to the rescue" and pre-pending all HREF items that are "left without prefixes"...  Problem is: it adds in the domain of the site as well.

I suppose your other option is to: "remove the domain" from the $fileurl reference as well.

By the way, the "fix" has to be made in both do_shortcodes and do_default_attachs

Thanks!

Reply
Share:
Green
Default
Pear
Black Emo
{green}:grinning:
{green}:wink:
{green}:face:
{green}:inlove:
{green}:sweaty:
{green}:surprised:
{green}:lovekiss:
{green}:laugh:
{green}:formalsmile:
{green}:displeased:
{green}:cool:
{green}:resent:
{green}:nerd:
{green}:screaming:
{green}:amazed:
{green}:sad:
{green}:deceitful:
{green}:starryeyes:
{green}:evil:
{green}:shocked:
{green}:tears:
{green}:sulky:
{green}:smile:
{green}:vomited:
{green}:hi:
{green}:afraid:
{green}:crazy:
{green}:rabid:
{green}:fighting:
{green}:nonoise:
{green}:blushed:
{green}:idontknow:
{green}:scared:
{green}:razz:
{green}:kiss:
{green}:eat:
{green}:shutmouth:
{green}:gape:
{green}:suspicious:
{green}:laughingoutloud:
{green}:bruise:
{green}:crying:
{green}:pray:
{green}:serious:
{green}:excitement:
:)
:d
:wink:
:mrgreen:
:neutral:
:twisted:
:arrow:
:shock:
:???:
:cool:
:evil:
:oops:
:razz:
:roll:
:cry:
:eek:
:lol:
:mad:
:sad:
:!:
:?:
:idea:
:hmm:
:beg:
:whew:
:chuckle:
:silly:
:envy:
:shutmouth:
{pear}:happy:
{pear}:smile:
{pear}:laugh:
{pear}:laughingoutloud:
{pear}:crying:
{pear}:exhausted:
{pear}:nerd:
{pear}:surprised:
{pear}:veryhungry:
{pear}:wink:
{blackemo}:laughtertotears:
{blackemo}:gift:
{blackemo}:love:
{blackemo}:inlove:
{blackemo}:shamefaced:
{blackemo}:heart:
{blackemo}:crazy:
{blackemo}:anguished:
{blackemo}:bruise:
{blackemo}:easymoney:
{blackemo}:exhausted:
{blackemo}:vampire:
{blackemo}:shutmouth:
{blackemo}:wink:
{blackemo}:carnival:
{blackemo}:flowers:
{blackemo}:hotdrink:
{blackemo}:party: