Seaside icon indicating copy to clipboard operation
Seaside copied to clipboard

Error while adding some files in a FileLibrary

Open jecisc opened this issue 6 years ago • 3 comments

I have a folder with images named "1-1.jpg" for example, this cannot be added to the FileLibrary but those are not my files so I cannot rename them.

Stack:

UndefinedObject(Object)>>doesNotUnderstand: #,
MDDemoLibrary class(WAFileMetadataLibrary class)>>addFileNamed:contents:
MDDemoLibrary class(WAAbstractFileLibrary class)>>addFileAt:contents:
MDDemoLibrary class(WAAbstractFileLibrary class)>>addFileAt:
UndefinedObject>>DoIt

jecisc avatar Aug 21 '17 18:08 jecisc

The culprit is WAAbstractFileLibrary class>>asSelector:. It tries to generate a selector from the string '1-1' which would not be a legal selector. Unfortunately, the method answers nil in that case.

I suggest to use an arbitrary prefix (e.g. the hash of the filename) instead of answering nil.

theseion avatar Aug 23 '17 20:08 theseion

Or maybe the numbers could be transformed to the number in letter? Because if I have "myFilev1.txt" and "myFilev2.txt" I suppose it will override "myFilev1.txt"?

jecisc avatar Aug 23 '17 22:08 jecisc

No, the current logic would create selectors myFilev1 and myFielv2. The problem with 1-1 is that none of the characters are legal start characters, otherwise digits are allowed as part of a selector.

theseion avatar Aug 24 '17 04:08 theseion