#1 March 30, 2016 1:54pm

jmason03
Member
Registered: January 9, 2014
Posts: 123

Trailing Slash with PDF Links

I'm having an issue with pdf links specifically getting converted in IPLs and when they are decoded they have a / that has been added to the end of the url and breaks the pdf link. I know it's not coming from the TinyMCE editor and have confirmed they are getting converted to IPLs after my html field is processed. What change and which of the IPL related functions is responsible for that? Is it a problem in the encoding or decoding process?

Offline

#2 March 30, 2016 4:34pm

timbuckingham
Administrator
From: Baltimore, MD
Registered: April 2, 2012
Posts: 974

Re: Trailing Slash with PDF Links

What does the stored data look like before it's decoded? It should technically be stored as an irl:// link if it's a resource from the file manager.

Offline

#3 April 1, 2016 1:55pm

jmason03
Member
Registered: January 9, 2014
Posts: 123

Re: Trailing Slash with PDF Links

Here is what is stored in the database as: ipl://3532//WyJhcmNoaXRlY3QiLCJwZGYiLCJsb29wLnBkZiJd
Here is what I entered: http://www.drury.edu/academics/undergra … f/loop.pdf

The file does already exist at the path when the link was added. Also, I just realized that is happening in the 301 redirects as well. Also, the page with the id of 3532 is http://www.drury.edu/academics/undergrad/ and it's on a routed template which I'm thinking might have something to do with it? BigTree is thinking everything after that is part of the route/commands and isn't recognizing it as a pdf/file?

Offline

#4 April 4, 2016 8:40am

timbuckingham
Administrator
From: Baltimore, MD
Registered: April 2, 2012
Posts: 974

Re: Trailing Slash with PDF Links

Am I remembering correctly that you have some kind of hack in place to allow files to appear / live in directories under a page? I'm guessing that's why it's converting it to an IPL (it sees the page path portion and converts it to a page). If I'm not going crazy, can you give me the code that you're currently using to make that work so that I can replicate in my dev environment and try to get a fix in place?

Offline

#5 April 4, 2016 8:43am

jmason03
Member
Registered: January 9, 2014
Posts: 123

Re: Trailing Slash with PDF Links

Ok yeah, I can see how that might cause an issue. All I did to allow for that was to comment out this piece in the updatePage and createPage functions in admin.php:

/*while (file_exists(SERVER_ROOT."site/".$route."/")) {
        $route = $oroute."-".$x;
    $x++;
}*/

Offline

#6 April 4, 2016 2:36pm

jmason03
Member
Registered: January 9, 2014
Posts: 123

Re: Trailing Slash with PDF Links

I just realized it would probably help to have the code that handles redirects from a folder to a page. So this would be for instances where there was a folder structured like /site/undergrad with some pdf documents in it. Then if the user browses to domain.edu/undergrad, this code is in the index.php file and gets run. I don't know if you need this to help see what's happening, but I figured it might be part of the problem.

<?
    $serverRoot = str_replace("site\\","",__FILE__);
    $serverRoot = strtolower($serverRoot); //In case someone enters a URL with capital letters
    $serverRoot = str_replace("web\sectionindexreplacement.php", "", $serverRoot);
   
        // Check that server root was setup correctly and points to the right place
    if(file_exists($serverRoot."\\custom\\environment.php") == 'OK' && file_exists($serverRoot."\\core\\bootstrap.php") == 'OK'):
        $url = $_GET["bigtree_htaccess_url"] = ltrim(rtrim($_SERVER["REQUEST_URI"], '/'), '/');
        $_SERVER["PATH_INFO"] = array_values(array_filter(explode('/', $url)));
        chdir($serverRoot . "\\site");
        require $serverRoot."\\site\\index.php";
    else:
        header("Location: http://www.drury.edu/404");
        die();
    endif;

Offline

#7 April 7, 2016 1:57pm

timbuckingham
Administrator
From: Baltimore, MD
Registered: April 2, 2012
Posts: 974

Re: Trailing Slash with PDF Links

Ok, I think I fixed it with this commit:
https://github.com/bigtreecms/BigTree-C … 75efbf9657

Let me know if it still bugs out on you -- thanks for sticking with me!

Offline

Board footer

Powered by FluxBB

The Discussion Forum is not available on displays of this size.