Page MenuHome

inconsistent handling of filenames derived from image names
Closed, ResolvedPublic

Description

System Information
Operating system: windows-10
Graphics card: nvidia

Blender Version
Broken: 2.80
Worked:

Short description of error

special characters in image names are treated differently depending on how an image is saved to file. the issue seems to happen on Windows-10 and on MAC. See also related report: https://developer.blender.org/T69064

Exact steps for others to reproduce the error

  1. open the blendfile
  2. from the top row of the UV editor select image -> save
  3. Check that the filename in the file selector input field is preset to "template:uvgrid.png"
  4. do not change the filename in the file selector box
  5. store the file to the file system
  6. check on the file system that the file is named "template" and has length 0 (actually this is a stream and not a file)

Now do the very same thing except in step 2:

  1. reopen the blend file
  2. from the top row of the UV editor select image -> save as ...
  3. proceed as described above ...

You see that blender now tries to replace the ":" in the filename by "_" as soon as you try to save the file.

I guess the correct behavior is to:

  • either allow the ":" in the filename and never modify the filename automatically (let the user handle this)
  • or always take care that no special characters can ever be used for filenames (let blender handle this)

the current mix seems to be not ideal :)

Event Timeline

Just for reference on why windows is just not flat out rejecting filenames with : in it

NTFS supports a thing called alternate data streams

the following is completely legal

f:\test>echo hi > hi.txt
f:\test>echo hello world > hi.txt:hello
f:\test>dir hi.txt
 Volume in drive F is BlahBlah
 Volume Serial Number is 1234-1234

 Directory of f:\test

2019-08-27  10:08 AM                 5 hi.txt

f:\test>more < hi.txt
hi

f:\test>more < h1.txt:hello:$DATA
hello world

however not many apps can deal with this construct and if we just not support it and forbid the : character in a filename, I doubt anyone would miss it.

or always take care that no special characters can ever be used for filenames (let blender handle this)

That seems the simplest approach.
A good principle is "Be liberal in what you accept and conservative in what you output", which applied to this case means sanitizing the filenames by replacing weird characters with '_' or such.

No special chars are supposed to be allowed in our filnames... that's just a bug of a missing check somewhere in the code

Bastien Montagne (mont29) lowered the priority of this task from Needs Triage by Developer to Confirmed, Medium.Aug 27 2019, 7:20 PM

Did not resolve because of "/" and ":" for Macintosh.
https://developer.blender.org/T69064

@Bastien Montagne (mont29) did not resolve yet. Need to fix automatic " : " change to " _ " itself because of Macintosh cause appear " / " on Finder from " : " on Blender 2.81 beta.

@Kent Davis (mac4kent) afaik issue reported here has been fixed. If you think it is not, please explain properly your problem, your sentence above make no sense to me. Or open a new report with all expected info, and a *precise and complete* description of the issue.