Skip to content

Commit

Permalink
Merge of #9487
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Dec 17, 2024
2 parents f766179 + 15f416c commit fd9a5c7
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion apps/app/public/static/locales/en_US/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
"duplicated_path": "Duplicated path",
"Link sharing is disabled": "Link sharing is disabled",
"successfully_saved_the_page": "Successfully saved the page",
"you_can_not_create_page_with_this_name": "You can not create page with this name",
"you_can_not_create_page_with_this_name_or_hierarchy": "You can not create page with this name or page hierarchy",
"not_allowed_to_see_this_page": "You cannot see this page",
"Confirm": "Confirm",
"Successfully requested": "Successfully requested.",
Expand Down
2 changes: 1 addition & 1 deletion apps/app/public/static/locales/fr_FR/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
"duplicated_path": "Chemin dupliqué",
"Link sharing is disabled": "Le partage est désactivé",
"successfully_saved_the_page": "Page sauvegardée",
"you_can_not_create_page_with_this_name": "Vous ne pouvez pas créer cette page",
"you_can_not_create_page_with_this_name_or_hierarchy": "Vous ne pouvez pas créer de page avec ce nom ou cette hiérarchie de pages",
"not_allowed_to_see_this_page": "Vous ne pouvez pas voir cette page",
"Confirm": "Confirmer",
"Successfully requested": "Demande envoyée.",
Expand Down
2 changes: 1 addition & 1 deletion apps/app/public/static/locales/ja_JP/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
"duplicated_path": "重複したパス",
"Link sharing is disabled": "リンクのシェアは無効化されています",
"successfully_saved_the_page": "ページが正常に保存されました",
"you_can_not_create_page_with_this_name": "この名前でページを作成することはできません",
"you_can_not_create_page_with_this_name_or_hierarchy": "この名前、または階層でページを作成することはできません",
"not_allowed_to_see_this_page": "このページは閲覧できません",
"Confirm": "確認",
"Successfully requested": "正常に処理を受け付けました",
Expand Down
2 changes: 1 addition & 1 deletion apps/app/public/static/locales/zh_CN/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
"duplicated_path": "Duplicated path",
"Link sharing is disabled": "你不允许分享该链接",
"successfully_saved_the_page": "成功地保存了该页面",
"you_can_not_create_page_with_this_name": "您无法使用此名称创建页面",
"you_can_not_create_page_with_this_name_or_hierarchy": "您無法使用此名稱或頁面層級建立頁面",
"not_allowed_to_see_this_page": "你不能看到这个页面",
"Confirm": "确定",
"Successfully requested": "进程成功接受",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export const useNewPageInput = (): UseNewPageInput => {
const isCreatable = pagePathUtils.isCreatablePage(newPagePath);

if (!isCreatable) {
toastWarning(t('you_can_not_create_page_with_this_name'));
toastWarning(t('you_can_not_create_page_with_this_name_or_hierarchy'));
return;
}

Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/utils/page-path-utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import escapeStringRegexp from 'escape-string-regexp';

import { IUser } from '~/interfaces';
import type { IUser } from '~/interfaces';

import { isValidObjectId } from '../objectid-utils';
import { addTrailingSlash } from '../path-utils';
Expand Down Expand Up @@ -117,6 +117,7 @@ const restrictedPatternsToCreate: Array<RegExp> = [
/^\/(_search|_private-legacy-pages)(\/.*|$)/,
/^\/(installer|register|login|logout|admin|me|files|trash|paste|comments|tags|share|attachment)(\/.*|$)/,
/^\/user(?:\/[^/]+)?$/, // https://regex101.com/r/9Eh2S1/1
/^(\/.+){130,}$/, // avoid deep layer path. see: https://regex101.com/r/L0kzOD/1
];
export const isCreatablePage = (path: string): boolean => {
return !restrictedPatternsToCreate.some(pattern => path.match(pattern));
Expand Down

0 comments on commit fd9a5c7

Please sign in to comment.