kittsville / WP-Librarian

WP-Librarian is an inventory management WordPress plugin for keeping track of books and media
GNU General Public License v3.0
4 stars 1 forks source link

Wiki's Technical Docs sidebar has several broken links #65

Closed kittsville closed 8 years ago

kittsville commented 8 years ago

Several of the links of the sidebar that displays on all Technical Docs pages of the wiki don't work. This is because they are linking to URLs with /Technical-Docs in them which won't work as all wiki pages have wiki-side unique and absolute URLs.

I'm not sure when this issue started happening so I'm not sure what caused it. There's always a chance it's not an issue my end (yay, I guess).

Edit: Skip to the end for a tl;dr after I worked out what was causing it.

kittsville commented 8 years ago

The pattern seems to be that all single worded pages in the sidebar are broken but the two two worded pages aren't. Both links below were automatically generated.

Here's a broken link for reference: https://github.com/kittsville/WP-Librarian/wiki/Technical-Docs/Releases

And a working one: https://github.com/kittsville/WP-Librarian/wiki/User-Roles

I'll try a dummy commit to see if that fixes everything.

kittsville commented 8 years ago

Nope, still broken.

kittsville commented 8 years ago

As tested on the wiki 9f978fca74374ffff157ab4799bab82580c5dbd6 one of the broken links was fixed by making it multi-part rather than a single word.

The change:

Filters -> Filters Testing Test

Fixes the sidebar link for Filters while reverting it to its original name causes the problem to return.

kittsville commented 8 years ago

Haha, oh wow. I had the Actions and Filters pages link to each other to test out if their links broke. They've broken but in the way the sidebar's links used to break, by becoming image tags >.<

Time to apply the fix applied to the sidebar to the links to test the other issue.

kittsville commented 8 years ago

Link to other issue, for reference.

kittsville commented 8 years ago

Right, after applying the fix so the other issue wouldn't crop up I'm getting the same issue as the sidebar. So now we know this is not just limited to _sidebar links. The issue is GitHub's version of Gollum adding junk to the URL, which then creates a broken link because all wiki URLs are absolute.

So, the million dollar question, why are only certain links being affected? I'm pretty sure this is an issue on GitHub's end but if I don't have the specifics then I'm just wasting their time.

kittsville commented 8 years ago

I've been missing something obvious: it's only been affecting the sidebar's sub-headings, the wiki files directly under the /Technical-Docs folder. All the other .md files under that folder are in sub-folders and thus (for some reason) don't get their links broken.

I thought maybe the issue was Gollum has issues if there are .md files in the same sub-folder as there are folders but that doesn't seem to be the case. Perhaps the issue lies with the folder being double barrelled (Technical Docs). If I renamed it to Technical that might fix everything.

kittsville commented 8 years ago

I forgot what renaming folders did to commits. Okay I'm creating a test repo for this.

kittsville commented 8 years ago

Well, this is odd. I've failed to replicate the issue in my test setup:

https://github.com/kittsville/Gollum-Bug-Test/wiki

In this setup pages Two and Six are both under a two word folder and so should have broken links to each other. But yet the links are fine. Maybe this is an issue my end after all.

kittsville commented 8 years ago

Fuck it. This is a post-Christmas issue

kittsville commented 8 years ago

Post-Christmas. I think the wiki is haunted.

kittsville commented 8 years ago

I'll try adding the entire Technical Docs directory to the test wiki to see if the issue occurs there. If it does it'll mean I'll stop adding silly commits to the actual wiki.

kittsville commented 8 years ago

I've worked it out:

This issue occurs when there is a folder with the same name as a page. Having Bar.md in the same directory as Bar/ will cause any links to Bar from other pages in the same folder as Bar to be generated incorrectly. e.g.

Any links to Foo.md will be generated as /kittsville/my-repo/wiki/Foo and will work Links to Bar.md from pages under directly under Docs/ (Foo.md, Bar.md and _sidebar.md) will be generated as /kittsville/my-repo/wiki/Docs/Bar and thus won't work.

This means it's not an issue with me but with either Gollum or GitHub's special version of it. I'll see what GitHub support knows about and it and if it's not them then I'll ask someone to try to replicate it in regular Gollum.

kittsville commented 8 years ago

There's no solution but renaming the folders will at least be a decent enough workaround.

kittsville commented 8 years ago

Can confirm, wiki links are fixed with f0a60a823bc4685d85a24581af704da81aa58033