PrimeIntellect/SWE-rebench-V2-Filtered-Easy-Verified huggingface dataset:
Repository: renehernandez/obsidian-readwise (ts)
Issue: Sanitize the Pipe (|) Character in Titles
Hi there! I noticed that the pipe character is often included on page titles, but this is difficult to deal with in Obsidian because the pipe character is used in Wikilinks to alias the name. Would it be possible to add the pipe character to the list of sanitized characters?
Pull request description: Add sanitization for pipe character
## Description

Fix #64 

## Other Changes

- Add test to validate existing sanitization for dot character 

Patch:
diff --git a/src/fileDoc.ts b/src/fileDoc.ts
index 5d3a00d..a5de3e1 100644
--- a/src/fileDoc.ts
+++ b/src/fileDoc.ts
@@ -51,13 +51,11 @@ export class FileDoc {
     }
 
     public sanitizeName(): string {
-        console.log(`Replacing ${this.doc.title}`);
+        console.log(`Sanitizing ${this.doc.title}`);
         return this.doc.title
             .replace(/(http[s]?\:\/\/)/, '')
-            .replace(/\./g, '_')
-            .replace(/\//g, '-')
             .replace(/(\?.*)/, '') // Remove query params
-            .replace(/\\/g, '-')
-            .replace(/\:/g, '-')
+            .replace(/\./g, '_')
+            .replace(/[\/\\\:\|]/g, '-')
     }
 }


Test patch:
diff --git a/tests/fileDoc.ts b/tests/fileDoc.ts
index 28133de..a05af37 100644
--- a/tests/fileDoc.ts
+++ b/tests/fileDoc.ts
@@ -50,6 +50,18 @@ describe("File Doc", () => {
             assert.equal(fileDoc.sanitizeName(), 'Hello-World')
         });
 
+        it("replaces |", () => {
+            fileDoc.doc.title = "Hello|World";
+
+            assert.equal(fileDoc.sanitizeName(), 'Hello-World')
+        })
+
+        it("replaces .", () => {
+            fileDoc.doc.title = "Hello.World";
+
+            assert.equal(fileDoc.sanitizeName(), 'Hello_World')
+        })
+
         it("Removes query params, slashes and protocol from URL (http and https)", () => {
             fileDoc.doc.title = "https://example.com/2021-04-26/article-name-12?foo=bar&key=value";