superfile icon indicating copy to clipboard operation
superfile copied to clipboard

Creating a file called . creates file in parent dir with the same name as the dir the file was created in

Open booth-w opened this issue 11 months ago • 9 comments

Describe the bug Creating a file called . creates one in the parent dir and names it the same name as parent with (1) at the end.

To Reproduce Create dir. For example, test. In test, create file .. In the parent of test, there will now be dir test and file test(1).

Expected behavior Creating a file called . should not be allowed.

System information (please complete the following information):

  • OS: Arch Linux
  • Version: 6.10.2-arch1-1
  • superfile Version: v1.1.7.1 (b157637)

booth-w avatar Jan 24 '25 17:01 booth-w

Reproduced bug in MacOS too

Image

Also passing .. also causes similiar behaviour but directory 2 level up is created as a new file.

lazysegtree avatar Jan 24 '25 18:01 lazysegtree

Behaviour of yazi - Warns about replacing the directory and doesn't do anything and pressing enters ( operation is ignored )

Image Image

lazysegtree avatar Jan 24 '25 18:01 lazysegtree

Any name that ends with . or .. (including xyz/../abc/.., ../. , ../.) will also cause such behaviour. We should avoid ctrl+n operation in case of name either being . or .. , or ending with /. or /.. We cant avoid all names ending with . as abc. is valid.

Also need to consider the behaviour in windows.

lazysegtree avatar Jan 24 '25 18:01 lazysegtree

Thanks @booth-w for this bug report.

lazysegtree avatar Jan 24 '25 18:01 lazysegtree

Hey would like to work on this one if its available. Thanks

TheLazron avatar May 12 '25 06:05 TheLazron

Sure. @TheLazron .

lazysegtree avatar May 13 '25 02:05 lazysegtree

Also need to consider the behaviour in windows.

Facing this bug on windows as well

TheLazron avatar May 15 '25 16:05 TheLazron

@lazysegtree should I make another pull request, made a typo in my fork's branch name. Also if you have any inputs on the fix Thanks!

TheLazron avatar May 15 '25 18:05 TheLazron

fork's branch name is okay. No need for another PR

lazysegtree avatar May 16 '25 02:05 lazysegtree