Emojis in the file name are not counted correctly for windows path length limits

Once you’ve done the above, delete everything above this line.

Steps to reproduce

  • Rename a file with an emoji that is past the path limit
  • this is an exact file name that is past the windows limit, but obsidian allows on windows
awefoawjefda asdfawefawefaw awefeawdddddddddddddddddddddddddddddddddddddddddddddddddddddd awefawefaweofjawlefkjaef asdfaewfawef awefaef awefaefa aegaergegr sdgergrg dgergserg regsergaweg aergaegaegawef aleifjejawefhuiewafihuef asefwe awefaefw aefaewf📘

Did you follow the troubleshooting guide? [Y/N]

  • Yes. I was able to create the file in the sandbox mode that was past the limit. Same exact file name that caused the error. I can’t check this exactly because I am not going to sync a different vault to my phone or figure out how exactly windows determines path lengths and write code to do that.

Expected result

  • Attempting to rename a file past the limit gives an error message or just doesn’t allow it to happen

Actual result

  • Could create a filename past the limit.
  • Obsidian Sync on mobile, understood that the file length was too long and gave the error message of illegal characters

Environment

  • The operating system is wrong here. I have windows 11
    SYSTEM INFO:
    Obsidian version: v1.5.11
    Installer version: v1.4.16
    Operating system: Windows 10 Home 10.0.22631
    Login status: logged in
    Catalyst license: none
    Insider build toggle: off
    Live preview: on
    Base theme: adapt to system
    Community theme: none
    Snippets enabled: 0
    Restricted mode: off
    Plugins installed: 3
    Plugins enabled: 3

Additional information

  • It seems that the method of checking length that is used on android mobile for deciding whether to sync a file is the correct method. Using that same method if possible on the desktop seems like it would fix the issue.
  • This file caused issues outside of obsidian when the path was too long which shows that what the desktop is using to count length is wrong.
  • With one emoji, I needed to delete two characters in order to get it back to within actual length limits.

I got another error related to this today that was hard to determine the cause. Just providing more details here for searchability in case someone else has the same problem.

I am using windows, but use WSL for writing and running some programs that interact with my markdown notes. The error I got today was generic Error scanning directory and does not tell you which file is the problematic one. Using git bash rather than WSL, allows for seeing the problematic file. If I use powershell to list files in the directory, I don’t get an error at all.