Two letter virtual folders mistaken for locales #943

Open
opened 2026-02-20 15:25:54 -05:00 by deekerman · 3 comments
Owner

Originally created by @invisiblethreat on GitHub (Dec 7, 2019).

Originally assigned to: @NGPixel on GitHub.

When linking to something before it exists, like db/postgres from "home" and then clicking through to the dialogue to create the new page, you end up with an unlocalized page creation dialog that you can still use. Upon clicking through and creating the page, when you attempt to save, you receive an SQL error. This is potentially due to the db section being mistaken for the locale.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'home'
  2. Edit the page to add a link to a new "short" virtual folder/page that does not yet exist, like db/postgres
  3. Click through the creation dialog
  4. Attempt to save the page and capture the error

Expected behavior
Throw an error for unsupported locale/action. The modal for creating a new pages does not permit short paths that would conflict with this locales, which may be good enough, but I wanted to raise this issue if folks though it would be helpful to trap it.

Screenshots
image

image

image

image

Host Info (please complete the following information):

  • OS: Docker, requarks/wiki:2
  • Wiki.js version: 2.0.12
  • Database engine: MariaDB 10.4.7-MariaDB-1:10.4.7+maria~bionic

Additional context
Again, this is an edge case that I'm not sure that many folks will hit, so it might not be worth the code to fix/prevent, but I wanted to let you know. Thanks for the cool project!

Originally created by @invisiblethreat on GitHub (Dec 7, 2019). Originally assigned to: @NGPixel on GitHub. When linking to something before it exists, like `db/postgres` from "home" and then clicking through to the dialogue to create the new page, you end up with an unlocalized page creation dialog that you can still use. Upon clicking through and creating the page, when you attempt to save, you receive an SQL error. This is potentially due to the `db` section being mistaken for the locale. **To Reproduce** Steps to reproduce the behavior: 1. Go to 'home' 2. Edit the page to add a link to a new "short" virtual folder/page that does not yet exist, like `db/postgres` 3. Click through the creation dialog 4. Attempt to save the page and capture the error **Expected behavior** Throw an error for unsupported locale/action. The modal for creating a new pages does not permit short paths that would conflict with this locales, which may be good enough, but I wanted to raise this issue if folks though it would be helpful to trap it. **Screenshots** ![image](https://user-images.githubusercontent.com/2525006/70379154-487b7900-18ff-11ea-9288-2f2915490faa.png) ![image](https://user-images.githubusercontent.com/2525006/70379162-5df0a300-18ff-11ea-928c-55f5418dc554.png) ![image](https://user-images.githubusercontent.com/2525006/70379168-6c3ebf00-18ff-11ea-9036-49230e0d1e18.png) ![image](https://user-images.githubusercontent.com/2525006/70379176-94c6b900-18ff-11ea-8d58-479fb3a4f63d.png) **Host Info (please complete the following information):** - OS: Docker, requarks/wiki:2 - Wiki.js version: 2.0.12 - Database engine: MariaDB 10.4.7-MariaDB-1:10.4.7+maria~bionic **Additional context** Again, this is an edge case that I'm not sure that many folks will hit, so it might not be worth the code to fix/prevent, but I wanted to let you know. Thanks for the cool project!
Author
Owner

@mielipuolinen commented on GitHub (Jan 16, 2020):

Can confirm this issue too, run into it few times before I realized what was happening. :)

Pages can be renamed into two-character path names which causes issues too and things start to act weird.

@mielipuolinen commented on GitHub (Jan 16, 2020): Can confirm this issue too, run into it few times before I realized what was happening. :) Pages can be renamed into two-character path names which causes issues too and things start to act weird.
Author
Owner

@juliendms commented on GitHub (Mar 11, 2020):

There is also an issue with Assets folder with only two letters. You can add pictures in those folders, but when you add them on the page, it returns a 404 error instead of loading the images.
Cf. https://requarks.slack.com/archives/C49J7AB8R/p1583228731093200

@juliendms commented on GitHub (Mar 11, 2020): There is also an issue with Assets folder with only two letters. You can add pictures in those folders, but when you add them on the page, it returns a 404 error instead of loading the images. Cf. https://requarks.slack.com/archives/C49J7AB8R/p1583228731093200
Author
Owner

@BPowell76 commented on GitHub (Nov 16, 2024):

I'm going to give a crack at this, but I've got to study how everything comes together. The plan is to ignore the path all together if multilingual pages is disabled as turning that setting on prepends the locale code to the path. If the locale is prepended to the path, then creating a two-letter page/path doesn't trigger the issue.

@BPowell76 commented on GitHub (Nov 16, 2024): I'm going to give a crack at this, but I've got to study how everything comes together. The plan is to ignore the path all together if multilingual pages is disabled as turning that setting on prepends the locale code to the path. If the locale is prepended to the path, then creating a two-letter page/path doesn't trigger the issue.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/wiki#943
No description provided.