Quote:
Originally Posted by kovidgoyal
Merged.
|
Thanks.
Quote:
Originally Posted by kovidgoyal
I'm not comfortable with the replace('..', '.') there may be other palces in the url where .. is needed and since the .. does not cause any actual problems, its safer to leave it in.
|
I understand your concerns, but yes, it does cause actual problems. Look at this:
Code:
http://g-ecx.images-amazon.com/images/G/03/ciu/80/50/1b46f96642a0b333ce906110.L._AA300_.jpg
becomes
http://g-ecx.images-amazon.com/images/G/03/ciu/80/50/1b46f96642a0b333ce906110.L..jpg
But the link with the double points doesn't work!
Please do at least something like this:
Code:
sparts = bn.split('_')
if len(sparts) > 2:
bn = (sparts[0] + sparts[-1]).replace("..jpg",".jpg")
return ('/'.join(parts[:-1]))+'/'+bn
EDIT: By the way, this is that book's amazon details page:
http://www.amazon.de/Bertelsmann-Jug...3422572&sr=8-1