URL changes, the trailing slash is striking again

Lex Spoon lex at lexspoon.org
Fri Feb 16 16:33:03 UTC 2007


Michel Bany <michel.bany at gmail.com> writes:
> Not sure if this has already been reported,
> 	(WAUrl new)
> 		addToPath: 'files';
> 		addToPath: 'basic.css';
> 		asString
> gives
> 	'/files/basic.css/'


FWIW, the URL classes in the image handle this.  They were written
back in '98 and have been carefully updated since then as problems
come up.  The approach is that a trailing slash mean the last part
of the path is an empty string.  To continue with this example:

FileUrl pathParts: #('files' 'basic.css')
   "yields file:///files/basic.css"

FileUrl pathParts: #('files' 'basic.css' '')
   "yields file:///files/basic.css/"



It would seem prudent to try and use the standard classes if possible.
That way we will avoid these "striking again" problems that come from
reinventing everything all the time.

See also the various "TimeStamp" and "Timestamp" classes that keep
reinventing DateAndTime.  Overall, Smalltalkers inherit quite a large
legacy of cool utility code.


-Lex




More information about the Squeak-dev mailing list