Seaside
Seaside copied to clipboard
Error while adding some files in a FileLibrary
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
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.
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"?
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.