sbrl / Pepperminty-Wiki

A wiki in a box
https://peppermint.mooncarrot.space/
Mozilla Public License 2.0
178 stars 20 forks source link

Scrub \n (%0A) characters from internal links #186

Closed SeanFromIT closed 4 years ago

SeanFromIT commented 4 years ago

If someone creates a link across a line break like:

[[some link]]

It will render normally by the browser, but the \n carries over to the filesystem & indexes and converts to %0A HTML character in URI (e.g. newpage=yes URL parameters). Suggest checking for \n and/or %0A and replacing with space (%20).

sbrl commented 4 years ago

Oooh, that 's a nice catch! Thanks for that.

Fixed - will land in v0.21

SeanFromIT commented 3 years ago

Just adding a comment in case someone runs into this- On upgrade, if you get 500 errors like: PHP Fatal error: Uncaught TypeError: Argument 2 passed to search::invindex_term_getoffsets() must be of the type int, string given, called in /var/www/html/index.php on line 6812 and a search index rebuild fixes it It may be related to this (look for \n in your indexes)

sbrl commented 3 years ago

Hrm, you could be right @SeanFromIT.

I suspect though that it's because when you updated you went straight past v0.21 (link to changelog), which has the following line in the changed section:

  • Improved the search indexing system performance - again
    • Another search index rebuild is required

I should perhaps do something about listing important administrative things that one should be aware of on update (e.g. like regenerating the search index) in a separate section of the changelog, rather than assuming that everyone will read the entire changelog :P