Page 2 of 2

Re: spaces and annotations in filenames

Posted: 2018-02-21T20:47:56-07:00
by snibgo
Ideally, IM would have a setting that meant: "Ignore special characters in filenames." But it doesn't, so including characters like ":[]" in filenames creates ambiguity, which is a bad idea. For example:

Code: Select all

TIFF:abc.tiff
Is this a file named "abc.tiff" with a "TIFF:" prefix, or is it a file named "TIFF:abc.tiff" with no prefix?

IM takes a dual approach, searching for both filenames.

The same problem occurs with square brackets:

Code: Select all

abc.tiff[0]
This might be a file named "abc.tiff" with an added suffix, or "abc.tiff[0]" with no suffix. (".tiff[0]" is a valid extension on Windows).

Again, IM will actually search for both.

But that is a total of four combinations, and IM won't search for all four. That's why a colon in the name, with square brackets not in the name, won't be found.

If a workflow accepts colons in filenames, then there might be two different files:

Code: Select all

abc.tiff
TIFF:abc.tiff
Suppose a convert command refers to "TIFF:abc.tiff". Which of those files should be used? Doubtless we could figure out which one IM will use, but it clearly causes confusion.

In my view, the best way to avoid the confusion is to have a workflow that prohibits any of ":[]" in filenames.

Re: spaces and annotations in filenames

Posted: 2018-02-22T07:21:49-07:00
by nagame
@Bonzo, @fmw42 : I understand that you are surprised to see colon in the file names. I also agree.
In my case, my company offers a web service for my clients (CMS). I do not ask my clients why filenames with colon. I see the errors in the logs of my server and I look for a solution. I found a first solution with the tool cat, a second is to remove the colon character of the file names. But from my point of view, it's still a bug in ImageMagick.

Re: spaces and annotations in filenames

Posted: 2018-02-22T07:32:14-07:00
by nagame
@snibgo : thanks for that precise answer. I understand now. I am going to modify our workflow to ban the characters ": [ ]"

Re: spaces and annotations in filenames

Posted: 2018-02-22T07:47:23-07:00
by snibgo
If you allow uploads from anyone, there are also security considerations. For example, don't allow quote characters.

Re: spaces and annotations in filenames

Posted: 2018-02-22T08:36:02-07:00
by Bonzo
@nagame it took me a while when I was starting out to realise spaces in filenames could be a pain as well!