Bug: Multi-rename can create illegal file names

Bugs and issues.
Post Reply
Message
Author
Free4all
Posts: 428
Joined: 30.09.2014, 21:12

Bug: Multi-rename can create illegal file names

#1 Post by Free4all » 08.05.2015, 06:51

FCXE Build 685 32-bit

Steps to reproduce:
1. Create a file named "a test.txt"
2. Select the file
3. Press Ctrl+M for multi-rename
4. Specify a replacement pattern of "[n,2]"
5. Press the Rename button

Actual result:
The file gets renamed to " text.txt", which is an illegal file name (first character is a space)

Expected result:
Either an abort error, or the space gets changed to an underscore. I recommend a warning message with an option to abort the rename or change leading spaces to underscores.

Karol
Posts: 965
Joined: 19.08.2007, 12:05

Re: Bug: Multi-rename can create illegal file names

#2 Post by Karol » 08.05.2015, 07:50

Space is legal character in the file name: https://msdn.microsoft.com/en-us/librar ... 85%29.aspx

Free4all
Posts: 428
Joined: 30.09.2014, 21:12

Re: Bug: Multi-rename can create illegal file names

#3 Post by Free4all » 08.05.2015, 21:36

Karol wrote:Space is legal character in the file name: https://msdn.microsoft.com/en-us/librar ... 85%29.aspx
Spaces as the first character(s) can cause all sorts of problems, including overwritten files during copy/move operations. The Windows shell doesn't support them, going back to Vista, I believe.

Timon
Posts: 729
Joined: 13.09.2012, 08:51

Re: Bug: Multi-rename can create illegal file names

#4 Post by Timon » 09.05.2015, 11:45

The Windows shell doesn't support them
Incorrect statement. Windows support them without any problems (even Windows XP). Try to create file name with first space in FC XE and try to open it in Windows explorer. File would be opened without any difficulties. But if you try to create file name with first space in Windows explorer, then first space would be truncated.

Free4all
Posts: 428
Joined: 30.09.2014, 21:12

Re: Bug: Multi-rename can create illegal file names

#5 Post by Free4all » 09.05.2015, 13:23

Timon wrote:
The Windows shell doesn't support them
Incorrect statement. Windows support them without any problems (even Windows XP). Try to create file name with first space in FC XE and try to open it in Windows explorer. File would be opened without any difficulties. But if you try to create file name with first space in Windows explorer, then first space would be truncated.
Yes and no. It doesn't fully support them. It kinda-sorta-in-some-specific-ways does. It won't allow the user to create a filename like that. For example take a file named " test.txt" and try to rename it to " test2.txt" in Windows Explorer. It will not rename it as expected, because it's not really supported. It will automatically remove the leading space and change the name to "test2.txt". Furthermore, it won't let the user create a file with any leading spaces via the New context menu. If it fully supported filenames with leading spaces, it wouldn't do those things.

I suppose one could nit-pick about the word "support" and find a more perfect word that describes the behavior exactly. Perhaps "recommend" would be a better word.

I don't know all the problems that could be caused by leading spaces, because it is such a gray area, and it's unknown how every program will handle the situation. It's probably best not to create files with names that Windows Explorer itself would not create. Why risk data loss by some program that doesn't handle them well (like a backup or sync program)?

Anyways, having an option to replace initial spaces with underscores during a multi-rename is probably in the users' best interest. I think a checkbox in the multi-rename window would do the trick.

Post Reply

Who is online

Users browsing this forum: No registered users and 21 guests