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

Broken links in Page Index #193

Closed
rhartmann opened this issue Jan 30, 2025 · 2 comments
Closed

Broken links in Page Index #193

rhartmann opened this issue Jan 30, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@rhartmann
Copy link
Contributor

The Page Index shows broken links for pages whose page name and page title (first header line) match in letters but not in case. The link href uses the page title, not the page name (derived from the filename).

Steps to reproduce:

  • Start fresh container with redimp/otterwiki:2-slim (v2.9.1)
    • I set environment variable RETAIN_PAGE_NAME_CASE=true (or Retain page name case. under Settings > Content and Editing Preferences), but the bug also occurs without this setting
  • Create new page such as ExamplePage
  • In the editor, change the case of the title line such as Examplepage or examplepage and save the page
    • When altering the title line (beyond just changing the case) like This is an Example Page, the bug does not occur
  • Go to Page Index, get broken link

I had a look into this and tried to provide a quick fix, but wasn't quite sure how to fix it. I suspect the issue here:

if i == len(arr) - 1 and header is not None:
hint = header
if (hint != part and hint.lower() == part.lower()) or (
hint == part and hint != part.lower()
):
arr[i] = hint
else:
arr[i] = (
part if app.config["RETAIN_PAGE_NAME_CASE"] else titleSs(part)
)

Or maybe here:

otterwiki/otterwiki/wiki.py

Lines 162 to 176 in 80f1190

pagetoc.append(
(
header[2], # depth
header[3], # title without formatting
url_for(
"view",
path=get_pagename(
f,
full=True,
header=pagename,
),
_anchor=header[4],
),
)
)

@redimp redimp added the bug Something isn't working label Jan 30, 2025
@redimp
Copy link
Owner

redimp commented Jan 30, 2025

Confirmed, i can reproduce this. Will look into it. Thx @rhartmann for digging into this.

@redimp redimp closed this as completed in 83dd439 Jan 31, 2025
@redimp
Copy link
Owner

redimp commented Jan 31, 2025

Fix released in v2.9.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants