Oliver-Akins / file-hider

A plugin for https://obsidian.md that allows hiding specific files and folders from the file explorer.
MIT License
60 stars 12 forks source link

Issue-25 Handle Carriage Returns in Filenames. #30

Closed drfloyd5 closed 6 months ago

drfloyd5 commented 1 year ago

Added CSS.escape(...) to changePathVisibility(...) to handle carriage return (\r) and other invalid querySelector paths characters.

Supporting Documentation: Use CSS.escape() to escape QuerySelectorAll() - Rick Strahl's Web Log javascript - What chars needs escaping in querySelector? - Stack Overflow

Found root cause using the Obsidian Developer Mode. Error Message:

Uncaught DOMException: Failed to execute 'querySelector' on 'Document': '[data-path="Icon
"]' is not a valid selector.
    at eval (plugin:obsidian-icon-folder:3775:39)

Tested by closing Obsidian. Updating code in plugin folder. Open Obsidian. Tested On macOS 12.6.3

drfloyd5 commented 1 year ago

Every OS has its filesystem quirks... it might be handy to "preload" the hidden files list with some metadata files like Icon\r.