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

Internal link with hash results in formatting as not-existing #3608

Closed
Klap-in opened this issue Jan 23, 2022 · 3 comments
Closed

Internal link with hash results in formatting as not-existing #3608

Klap-in opened this issue Jan 23, 2022 · 3 comments
Assignees
Labels

Comments

@Klap-in
Copy link
Collaborator

Klap-in commented Jan 23, 2022

At dokuwiki.org a lot of links with a hash becomes a red internal link, while the page exists and the hash is right and works as well.

From https://www.dokuwiki.org/faq#usage for example

  • [[page#Create a page|How to add pages?]]
  • [[page#Delete a page|Delete pages?]]
  • [[faq:howto-rename-pages]|Rename pages?]]

I guess something is changed, I haven’t traced it.

@Klap-in
Copy link
Collaborator Author

Klap-in commented Jan 24, 2022

First guess, not yet tested.
In metadata the hash is splitted:
@list($page) = explode('#', $id, 2);
In the internallink function not, see also 8c6be20

Part of #3272

@splitbrain splitbrain added this to Triage in Release "Igor" via automation Jan 26, 2022
@splitbrain splitbrain added the Bug label Jan 26, 2022
@splitbrain splitbrain self-assigned this Jan 26, 2022
@splitbrain
Copy link
Collaborator

Correct, this broke with #3272. The old page_resolve function was also returning the existence info. For a cleaner API that part has been dropped in the new PageResolver class and the existence check is now done separately: https://github.com/splitbrain/dokuwiki/blob/014550766a823d0d84b238f30ad7cc57f8efccc5/inc/parser/xhtml.php#L896-L897

I see two ways to fix this:

  1. make page_exists() handle hashes
  2. remove hash handling from PageResolver and thus establish that all our methods expect IDs without hashes and that hashes have to be handled outside (eg. in the renderer above)

I think 2 would be the saner, cleaner way but 1 is probably less likely to break at further unexpected places...

@splitbrain splitbrain moved this from Triage to To Do in Release "Igor" Jan 27, 2022
@Klap-in
Copy link
Collaborator Author

Klap-in commented Feb 7, 2022

  1. Add manually splitting of hashes before page_exists(). Shows more explicitly what happens with the data.

code searches for quick impression:
Explode resolve_pageid
Explode page_exists

option 2 requires more changes in the logic used in the plugins, because you have to get the hash before the resolve. However, these resolve changes are of course already not backwards compatible.

I’m in favor of option 1, because it makes the page_exists() more robust, and does not change the working of page_exists().

Klap-in added a commit that referenced this issue Feb 17, 2022
handle hashes in page_exists. fixes #3608
Release "Igor" automation moved this from To Do to Done Feb 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Development

No branches or pull requests

2 participants