Error when attached file name has no extension

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Error when attached file name has no extension

Вася Чайко
Hello.

Error occured when I attach file with no extension. Method SpFilename
extension return nil.

Fix: SpFilename-extension.st

'From Squeak3.10.2 of ''5 June 2008'' [latest update: #7179] on 19 September 2008 at 2:04:25 am'! !SpFilename methodsFor: '*Swazoo-accessing' stamp: 'VasyaChajko 9/19/2008 02:02'! extension "Answer the receiver's extension if any.  This is the characters from the last occurrence of a period to the end, inclusive. E.g. the extension of 'squeak.image' is '.image'. Answer nil if none.  Note that e.g. .login has no extension." | string periodIndex | string := self tail. periodIndex := string lastIndexOf: $.. ^ periodIndex > 1 ifTrue: [ string copyFrom: periodIndex to: string size. ] ifFalse: [ ''. ].! !
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Error when attached file name has no extension

Nicolas Petton
Le vendredi 19 septembre 2008 à 02:09 +0700, Вася Чайко a écrit :
> Hello.
>
> Error occured when I attach file with no extension. Method SpFilename
> extension return nil.

Thanks again :)

Cheers!

Nico
>
> Fix: SpFilename-extension.st
> pièce jointe document texte brut (SpFilename-extension.st)
> 'From Squeak3.10.2 of ''5 June 2008'' [latest update: #7179] on 19 September 2008 at 2:04:25 am'!!SpFilename methodsFor: '*Swazoo-accessing' stamp: 'VasyaChajko 9/19/2008 02:02'!extension "Answer the receiver's extension if any.  This is the characters from the last occurrence of a period to the end, inclusive. E.g. the extension of 'squeak.image' is '.image'. Answer nil if none.  Note that e.g. .login has no extension." | string periodIndex | string := self tail. periodIndex := string lastIndexOf: $.. ^ periodIndex > 1 ifTrue: [ string copyFrom: periodIndex to: string size. ] ifFalse: [ ''. ].! !
> _______________________________________________ Aida mailing list [hidden email] http://lists.aidaweb.si/mailman/listinfo/aida

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida

signature.asc (196 bytes) Download Attachment