mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-07-17 10:06:00 +00:00
fix: preserve U+FEFF at chunk boundaries (#1010)
This commit is contained in:
@@ -41,7 +41,7 @@
|
||||
"dependencies": {
|
||||
"chokidar": "^4.0.0",
|
||||
"minimatch": "^10.2.5",
|
||||
"octagonal-wheels": "^0.1.47",
|
||||
"octagonal-wheels": "^0.1.50",
|
||||
"pouchdb-adapter-http": "^9.0.0",
|
||||
"pouchdb-adapter-leveldb": "^9.0.0",
|
||||
"pouchdb-core": "^9.0.0",
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"octagonal-wheels": "^0.1.47"
|
||||
"octagonal-wheels": "^0.1.50"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@playwright/test": "^1.58.2",
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
"check": "svelte-check --tsconfig ./tsconfig.app.json && tsc -p tsconfig.node.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"octagonal-wheels": "^0.1.47"
|
||||
"octagonal-wheels": "^0.1.50"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint-plugin-svelte": "^3.19.0",
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import { splitPiecesRabinKarp } from "@lib/string_and_binary/chunks.ts";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
describe("Rabin-Karp text splitting", () => {
|
||||
it("preserves U+FEFF at the beginning of an internal chunk", async () => {
|
||||
const content = `${"a".repeat(1024)}\uFEFF${"b".repeat(1024)}`;
|
||||
const createChunks = await splitPiecesRabinKarp(new Blob([content], { type: "text/plain" }), 1024, true, 1024);
|
||||
const chunks: string[] = [];
|
||||
|
||||
for await (const chunk of createChunks()) {
|
||||
chunks.push(chunk);
|
||||
}
|
||||
|
||||
expect(chunks).toHaveLength(3);
|
||||
expect(chunks[1].startsWith("\uFEFF")).toBe(true);
|
||||
expect(chunks.join("")).toBe(content);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user