Oni: Oni can't open and operate with files/folder with special chars in name

Created on 16 Aug 2018  路  6Comments  路  Source: onivim/oni

Oni Version: 0.36 64bit zipped
Operating System: Windows 7 64bit

Issue:
Oni struggles to operate with any file/folder with a # char in name. I've stumbled on this issue because I have a couple of log files named like foo#1234.log. Fiddling around a little bit more I found also that issues arise with folders named with a #.
Ex: C:\path\#hashed\file.txt is opened as a blank tab in Oni. Error reported in dev tool console is:

Error: ENOENT: no such file or directory, stat 'C:\path#hashed\file.txt'
                                                       ^ notice the collapsed \

My best guess is there is some regex or glob snafu going on. Out of curiosity I've tried a bunch of special chars and the following have the same issue, but maybe there are others like funky emojis\unicodes or similar:

# % ^ & ; ` '

I guess these are some niche cases, but maybe this is a symptom of something bigger lurking in the file scan logic.

Let me now if I can do something else!

Steps to reproduce:
Just create a bunch of files in a folder, name a few with a #, like #test.txt, Oni will not be able to open them.

0.3.8 bug good first issue

All 6 comments

Hello and welcome to the Oni repository! Thanks for opening your first issue here. To help us out, please make sure to include as much detail as possible - including screenshots and logs, if possible.

Try prepending \ to special characters, e.g. cd a\#b.

It's the same behaviour as vim, in your first example would be C:\path\\#hashed\file.txt or even C:\path\\\#hashed\file.txt

Let us know if this fails for some other character.

Sorry I should have specified it happens from either right click "Open with Oni" or from the File Explorer tab in Oni itself, it's not a path fed to a command or script.

Good catch, seems like we need to sanitize the file path before trying to open it.

Recently discovered this limitation, it also happens with "|" character. There are likely others.
Oni version: 0.3.7
MacOS: 10.13.6

I'll tag this as a good first issue, since I don't think it will be too awkward to do?

If you follow the code calls through from App.ts, the filesToOpen that are passed when you use right click end up over in:

https://github.com/onivim/oni/blob/2fd82f36cf4521974fe7a82c3093d3af2e55f27d/browser/src/Editor/NeovimEditor/NeovimEditor.tsx#L1005-L1012

Similarly, I think the code for the explorer is here:

https://github.com/onivim/oni/blob/2fd82f36cf4521974fe7a82c3093d3af2e55f27d/browser/src/Services/Explorer/ExplorerSplit.tsx#L233-L260

One thing I'm not sure on is if we should do a single fix in openFile which I think both use, or do a fix in both places and assume everywhere else is fine. I would guess in openFile is more complete, but it also makes me a little nervous since its used for opening basically everything in Oni, so a change there will affect a lot of different things. Any input/agree with it being suitable for someone to get used to the code? @Akin909 / @bryphe

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jordan-arenstein picture jordan-arenstein  路  22Comments

hboon picture hboon  路  21Comments

badosu picture badosu  路  24Comments

phaazon picture phaazon  路  21Comments

rektrex picture rektrex  路  18Comments