Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Directory Listings Missing First Character #79

Open
sqshr opened this issue Sep 27, 2022 · 2 comments
Open

Directory Listings Missing First Character #79

sqshr opened this issue Sep 27, 2022 · 2 comments

Comments

@sqshr
Copy link

sqshr commented Sep 27, 2022

Hello,
I have observed that when listing files (and clicking the subsequent links), the first character of the top level directory is missing. As a written example:

  • Wiki/Technical/Cisco.md

with Wiki as the root, when you click "List all pages" you see:

  • echnical/Cisco

These files are contents searchable- so it's not a wiki wide issue. I've had a look to try and work it out, but couldn't see where in the code the issue was (apologies). When listing all pages, the wiki doesn't throw out any errors. When you click one of the bad links you get the below error in the log:

FileNotFoundError: [Errno 2] No such file or directory: '/home/sqshr/Wiki/echnical/Cisco.md'

I know this error isn't useful for the above issue (hence omitting the Traceback)- but want to show willing :)

Thanks!

@sqshr sqshr changed the title Directory Listings (Sometimes) Missing First Character Directory Listings Missing First Character Sep 27, 2022
@sqshr
Copy link
Author

sqshr commented Sep 27, 2022

Ok, so- I've looked a little more. I think the issue comes from line 123 onwards in wiki.py

folder = root[len(cfg.wiki_directory + "/"):]

If I remove the + "/" from lines 123, 128, and 132- it seems to solve the problem. In a quick look round I couldn't see any ill effects elsewhere- but I'm not confident to state that for a fact!

@Oliver-Hanikel
Copy link
Contributor

list_wiki seems overall a bit janky. Instead of operating on strings we could use paths. This would make the code more resilient to edge cases like this one. It would probably make the code more readable too.

As a quick fix:
If you have the wiki directory configured with a trailing slash then drop it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants