⚡ Optimize file sanitization performance#49
Conversation
Co-authored-by: frostmute <989225+frostmute@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this comment.
Code Review
This pull request refactors the file sanitization logic in fileUtils.ts by moving the INVALID_CHARS_REGEX to a module-level constant and updating the sanitizeFileName function to use it. It also includes a minor formatting update to tests/GEMINI.md. Review feedback suggests expanding the regex to include additional characters restricted by Obsidian, such as brackets and carets, to ensure compatibility with wikilinks and block references.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
💡 What: Extracted the
invalidCharsRegExp insrc/utils/fileUtils.tsfrom inside thesanitizeFileNamefunction to a module-level constant namedINVALID_CHARS_REGEX.🎯 Why: To prevent repeated instantiations and recompilations of the regular expression object for every filename sanitized, saving CPU cycles and memory allocations.
📊 Measured Improvement: Running a benchmark of 1.2 million sanitization operations across various edge-case file names:
PR created automatically by Jules for task 4868528600160500700 started by @frostmute