diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.json index b819c4d76..3a8389b9e 100644 --- a/app/appearance/langs/en_US.json +++ b/app/appearance/langs/en_US.json @@ -109,7 +109,7 @@ "useDefaultWidth": "Use Default Column Width", "crossPageUse": "Tips for using multiple selections across pages: click at the start position, and after scrolling the page, at the end position ${}", "type": "Type", - "searchType": "Type (search in the following enabled types)", + "searchType": "Type (searches in the enabled types below, the filter option in the global search overrides this setting)", "searchAttr": "Attribute (search not only in the content, but also in the following enabled attributes)", "searchBackmention": "Backlink Mentions (backlink mentions search keywords are obtained from)", "searchVirtualRef": "Virtual reference (virtual reference search keywords are obtained from)", @@ -901,7 +901,7 @@ "103": "The update installation package has been automatically downloaded in the background. When exiting, you will be asked whether to install the new version", "104": "The update installation package failed to download, please check the network connection", "105": "Corrupted data repo have been automatically reset", - "106": "TODO", + "106": "The maximum length of the document name is 512 characters", "107": "Moving document [%s]", "108": "Cleaning obsolete indexes...", "109": "Remove reminder completed [%s]", diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.json index a5f8aeafe..9a4cb5100 100644 --- a/app/appearance/langs/es_ES.json +++ b/app/appearance/langs/es_ES.json @@ -109,7 +109,7 @@ "useDefaultWidth": "Usar el ancho de columna por defecto", "crossPageUse": "Consejos para utilizar selecciones múltiples a través de las páginas: haga clic en la posición inicial y, después de desplazarse por la página, en la posición final ${}", "type": "Tipo", - "searchType": "Tipo (búscar en los siguientes tipos habilitados)", + "searchType": "Tipos (busque en los tipos habilitados a continuación, la opción de filtro en la búsqueda global anula esta configuración)", "searchAttr": "Atributo (busca no sólo en el contenido, sino también en los siguientes atributos habilitados)", "searchBackmention": "Menciones de Backlinks (las menciones de backlinks de las que se obtienen las palabras clave de la búsqueda)", "searchVirtualRef": "Referencia virtual (las palabras clave de búsqueda de referencias virtuales se obtienen a partir de ellas)", @@ -901,7 +901,7 @@ "103": "El paquete de instalación de la actualización se ha descargado automáticamente en segundo plano. Al salir, se le preguntará si desea instalar la nueva versión", "104": "El paquete de instalación de la actualización no se pudo descargar, verifique la conexión de red", "105": "El repositorio de datos corruptos se ha restablecido automáticamente", - "106": "TODO", + "106": "La longitud máxima del nombre del documento es de 512 caracteres.", "107": "Moviendo documento [%s]", "108": "Limpiando índices obsoletos...", "109": "Eliminación de recordatorios completada [%s]", diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.json index 13aca0b42..22eea6650 100644 --- a/app/appearance/langs/fr_FR.json +++ b/app/appearance/langs/fr_FR.json @@ -109,7 +109,7 @@ "useDefaultWidth": "Utiliser la largeur de colonne par défaut", "crossPageUse": "Conseils pour utiliser plusieurs sélections sur plusieurs pages : cliquez à la position de départ et, après avoir fait défiler la page, à la position de fin ${}", "type": "Type", - "searchType": "Type (rechercher dans les types activés suivants)", + "searchType": "Types (recherche dans les types activés ci-dessous, l'option de filtre dans la recherche globale remplace ce paramètre)", "searchAttr": "Attribut (recherche non seulement dans le contenu, mais aussi dans les attributs activés suivants)", "searchBackmention": "Mentions de backlink (les mentions de backlink à partir desquelles les mots-clés de recherche sont obtenus)", "searchVirtualRef": "Référence virtuelle (les mots-clés de recherche de référence virtuelle sont obtenus à partir de)", @@ -901,7 +901,7 @@ "103": "Le package d'installation de la mise à jour a été automatiquement téléchargé en arrière-plan. En quittant, il vous sera demandé si vous souhaitez installer la nouvelle version", "104": "Le package d'installation de la mise à jour n'a pas pu être téléchargé, veuillez vérifier la connexion réseau", "105": "Le référentiel de données corrompu a été automatiquement réinitialisé", - "106": "TODO", + "106": "La longueur maximale du nom du document est de 512 caractères", "107": "Déplacement du document [%s]", "108": "Nettoyage des index obsolètes...", "109": "Supprimer le rappel terminé [%s]", diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.json index b8c66f329..af94ca843 100644 --- a/app/appearance/langs/zh_CHT.json +++ b/app/appearance/langs/zh_CHT.json @@ -109,7 +109,7 @@ "useDefaultWidth": "使用默認列寬", "crossPageUse": "跨頁多選使用提示:在開始位置單擊,滾動頁面以後在結束位置 ${}", "type": "類型", - "searchType": "類型(在以下啟用的類型中進行搜索)", + "searchType": "類型(在以下啟用的類型中進行搜索,全局搜索中的過濾選項會覆蓋該設置)", "searchAttr": "屬性(不僅在內容中進行搜索,同時也會在以下啟用的屬性中搜索)", "searchBackmention": "反鏈提及(反鏈提及搜索關鍵字從以下方式獲得)", "searchVirtualRef": "虛擬引用(虛擬引用搜索關鍵字從以下方式獲得)", @@ -901,7 +901,7 @@ "103": "已經在後台開始自動下載更新安裝包,退出時將詢問是否安裝新版本", "104": "更新安裝包下載失敗,請檢查網絡連接", "105": "已經自動重置損壞的數據倉庫", - "106": "TODO", + "106": "文檔名最大長度限制為 512 字符", "107": "正在移動文檔 [%s]", "108": "正在清理已過時的索引...", "109": "移除提醒完畢 [%s]", diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.json index 713265c03..b6165f387 100644 --- a/app/appearance/langs/zh_CN.json +++ b/app/appearance/langs/zh_CN.json @@ -109,7 +109,7 @@ "useDefaultWidth": "使用默认列宽", "crossPageUse": "跨页多选使用提示:在开始位置单击,滚动页面以后在结束位置 ${}", "type": "类型", - "searchType": "类型(在以下启用的类型中进行搜索)", + "searchType": "类型(在以下启用的类型中进行搜索,全局搜索中的过滤选项会覆盖该设置)", "searchAttr": "属性(不仅在内容中进行搜索,同时也会在以下启用的属性中搜索)", "searchBackmention": "反链提及(反链提及搜索关键字从以下方式获得)", "searchVirtualRef": "虚拟引用(虚拟引用搜索关键字从以下方式获得)", @@ -901,7 +901,7 @@ "103": "已经在后台开始自动下载更新安装包,退出时将询问是否安装新版本", "104": "更新安装包下载失败,请检查网络连接", "105": "已经自动重置损坏的数据仓库", - "106": "TODO", + "106": "文档名最大长度限制为 512 字符", "107": "正在移动文档 [%s]", "108": "正在清理已过时的索引...", "109": "移除提醒完毕 [%s]", diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-m0ztypq/20220414110705-tu2un99.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-m0ztypq/20220414110705-tu2un99.sy index 04d1e9fed..41d8f50ad 100644 --- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-m0ztypq/20220414110705-tu2un99.sy +++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-m0ztypq/20220414110705-tu2un99.sy @@ -5,7 +5,7 @@ "Properties": { "id": "20220414110705-tu2un99", "title": "收集箱", - "updated": "20220803164829" + "updated": "20221022010553" }, "Children": [ { @@ -366,10 +366,20 @@ "Type": "NodeCloseParen" } ] - }, + } + ] + }, + { + "ID": "20221022010309-yp452cb", + "Type": "NodeParagraph", + "Properties": { + "id": "20221022010309-yp452cb", + "updated": "20221022010553" + }, + "Children": [ { "Type": "NodeText", - "Data": "​" + "Data": "支持的消息类型为文本、图片、语音、视频和文件,单个图片、语音、视频和文件的大小不超过 10M。" } ] }, diff --git a/kernel/model/file.go b/kernel/model/file.go index ec552f4c2..678bce1e2 100644 --- a/kernel/model/file.go +++ b/kernel/model/file.go @@ -29,6 +29,7 @@ import ( "strconv" "strings" "time" + "unicode/utf8" "github.com/88250/gulu" "github.com/88250/lute/ast" @@ -1268,6 +1269,11 @@ func RenameDoc(boxID, p, title string) (err error) { } title = gulu.Str.RemoveInvisible(title) + if 512 < utf8.RuneCountInString(title) { + // 限制文档名称最大长度为 `512` https://github.com/siyuan-note/siyuan/issues/6299 + return errors.New(Conf.Language(106)) + } + oldTitle := tree.Root.IALAttr("title") if oldTitle == title { return @@ -1386,6 +1392,11 @@ func CreateDailyNote(boxID string) (p string, existed bool, err error) { func createDoc(boxID, p, title, dom string) (err error) { title = gulu.Str.RemoveInvisible(title) + if 512 < utf8.RuneCountInString(title) { + // 限制文档名称最大长度为 `512` https://github.com/siyuan-note/siyuan/issues/6299 + return errors.New(Conf.Language(106)) + } + baseName := strings.TrimSpace(path.Base(p)) if "" == strings.TrimSuffix(baseName, ".sy") { return errors.New(Conf.Language(16))