OleVik/grav-plugin-directorylisting

Base folder of site, not included in file links

dm9876 opened this issue · 9 comments

My site is hosted in sub folder of the web root. Eg http://localhost/testsite/mypage

If I have files in mypage and run the plugin there, it correctly lists the files however the link to the file is broken. If file is really at
http://localhost/testsite/mypage/file.pdf

The link is pointing to

http://localhost/mypage/file.pdf

I see new release now. I will test it first with that and comment again.

tested in v1.1.0 and the issue remains... I will look into it further if I can find some time

in this function recursiveArrayToList()

if i replace following line

//$url = $this->grav['page']->rawRoute();
$url = $this->grav['uri']->url;

then it works for normal situation. (href now absolute rather than relative, but does include the root folder)

however links to files in the 'include_additional' still have very broken links. (the base of those links are pointing to the path of the page where displayed instead of the path to the include_additional)

Could you illustrate this with some of the paths that are returned? For example the paths returned by the change in recursiveArrayToList() to use $url = $this->grav['uri']->url;, and the paths you are now getting from include_additional.

capture
screenshot of my page
links to main conent
http://localhost/tug/members/resources/ClubManual-May2010.pdf

links to content that is coming from additional

http://localhost/tug/members/resourcesD:/xampp/htdocs/tug/user/pages/02.about/paper-forms/Membership%20application%202016.doc

As you can see this running locally via xampp on windows

Sorry I think this makes is clearer:

$this->grav['page']->rawRoute()

returns "/members/resources"

$this->grav['uri']->url

returns "http://localhost/tug/members/resources"

Ahh, I see. This is indeed unintended, and a result of constraints on environments to test with. I should have a fix for this within the week.

Hi ! That issue still remains (v 1.1.1)
I'll use dm9876's hotfix.

Edit : Hotfix is working fine for normal situation, as told by @dm9876. Thx !

In v2.0.0-rc.1 this should be fixed: The plugin now entirely uses routes rather than paths, and treats only pages and associated media rather than files abstractly.