1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-16 08:09:32 +02:00

Avoid duplicate html files with names like 'index.htm'

This commit is contained in:
james.k.crook@gmail.com 2011-04-12 15:04:58 +00:00
parent 9438fdf3e5
commit eb904062ad
2 changed files with 2624 additions and 2622 deletions

View File

@ -28,6 +28,7 @@ import urllib
import textwrap import textwrap
import urlparse import urlparse
import os, os.path import os, os.path
import errno import errno
import hashlib import hashlib
import httplib import httplib
@ -616,7 +617,8 @@ def url_to_filename(url):
lpath = L[2].split('/') lpath = L[2].split('/')
if not '.' in lpath[-1]: if not '.' in lpath[-1]:
# url ends with a directory name. Store it under index.html. # url ends with a directory name. Store it under index.html.
L[2] += '/' + INDEX_HTML # L[2] += '/' + INDEX_HTML
L[2]=L[2]
else: else:
# 'title=' parsing # 'title=' parsing
if L[4].startswith('title=') and L[2].endswith('index.php'): if L[4].startswith('title=') and L[2].endswith('index.php'):
@ -692,7 +694,7 @@ def url_to_filename(url):
# Not really needed since we checked that the directory # Not really needed since we checked that the directory
# outdir didn't exist at the top of run(), but let's double check. # outdir didn't exist at the top of run(), but let's double check.
if os.path.exists(ans) and not config.overwrite: if os.path.exists(ans) and not config.overwrite:
out.write('File already exists: ' + str(ans)) out.write('File already exists: ' + str(ans)) #@UndefinedVariable
sys.exit(1) sys.exit(1)
f = open(ans, mode) f = open(ans, mode)