fix(memory-wiki): reserve fs-safe temp filename space · openclaw/openclaw@b8545d0
vincentkoc
·
2026-05-07
·
via Recent Commits to openclaw:main
File tree
extensions/memory-wiki/src
| Original file line number | Diff line number | Diff line change |
|---|
@@ -41,7 +41,9 @@ describe("slugifyWikiSegment", () => {
|
41 | 41 | const fileName = createWikiPageFilename(stem); |
42 | 42 | |
43 | 43 | expect(fileName.endsWith(".md")).toBe(true); |
44 | | -expect(Buffer.byteLength(`.${fileName}.fallback.tmp`)).toBeLessThanOrEqual(255); |
| 44 | +expect( |
| 45 | +Buffer.byteLength(`.${fileName}.00000000-0000-4000-8000-000000000000.fallback.tmp`), |
| 46 | +).toBeLessThanOrEqual(255); |
45 | 47 | expect(createWikiPageFilename(stem)).toBe(fileName); |
46 | 48 | }); |
47 | 49 | }); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -109,8 +109,11 @@ const RELATED_BLOCK_PATTERN = new RegExp(
|
109 | 109 | ); |
110 | 110 | const MAX_WIKI_SEGMENT_BYTES = 240; |
111 | 111 | const MAX_WIKI_FILENAME_COMPONENT_BYTES = 255; |
| 112 | +const FS_SAFE_PINNED_WRITE_TEMP_SUFFIX = ".00000000-0000-4000-8000-000000000000.fallback.tmp"; |
112 | 113 | const MAX_WIKI_SAFE_WRITE_FILENAME_COMPONENT_BYTES = |
113 | | -MAX_WIKI_FILENAME_COMPONENT_BYTES - Buffer.byteLength(".fallback.tmp") - 1; |
| 114 | +MAX_WIKI_FILENAME_COMPONENT_BYTES - |
| 115 | +Buffer.byteLength(FS_SAFE_PINNED_WRITE_TEMP_SUFFIX) - |
| 116 | +Buffer.byteLength("."); |
114 | 117 | const WIKI_SEGMENT_HASH_BYTES = 12; |
115 | 118 | |
116 | 119 | function truncateUtf8CodePointSafe(value: string, maxBytes: number): string { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。