oh-my-adhd 0.2.18 → 0.2.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -112,12 +112,14 @@ export function registerWikiImport(server) {
|
|
|
112
112
|
// Write thread content file if present
|
|
113
113
|
if (typeof thread.content === "string") {
|
|
114
114
|
const contentBytes = Buffer.byteLength(thread.content, "utf-8");
|
|
115
|
-
if (contentBytes
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
await fs.writeFile(tmp, thread.content, "utf-8");
|
|
119
|
-
await fs.rename(tmp, threadFile);
|
|
115
|
+
if (contentBytes > MAX_CONTENT_BYTES) {
|
|
116
|
+
skippedThreads++;
|
|
117
|
+
continue;
|
|
120
118
|
}
|
|
119
|
+
const threadFile = path.join(threadsDir, `${id}.md`);
|
|
120
|
+
const tmp = threadFile + ".tmp";
|
|
121
|
+
await fs.writeFile(tmp, thread.content, "utf-8");
|
|
122
|
+
await fs.rename(tmp, threadFile);
|
|
121
123
|
}
|
|
122
124
|
// Project only allowed ThreadMeta fields — no arbitrary spread
|
|
123
125
|
const meta = { id, title };
|
|
@@ -155,8 +157,10 @@ export function registerWikiImport(server) {
|
|
|
155
157
|
const page = rawPage;
|
|
156
158
|
const slug = typeof page.slug === "string" ? page.slug : "";
|
|
157
159
|
const content = typeof page.content === "string" ? page.content : "";
|
|
158
|
-
if (!SLUG_RE.test(slug) || !content)
|
|
160
|
+
if (!SLUG_RE.test(slug) || !content) {
|
|
161
|
+
skippedPages++;
|
|
159
162
|
continue;
|
|
163
|
+
}
|
|
160
164
|
if (Buffer.byteLength(content, "utf-8") > MAX_CONTENT_BYTES) {
|
|
161
165
|
skippedPages++;
|
|
162
166
|
continue;
|
package/package.json
CHANGED