summaryrefslogtreecommitdiffstats
path: root/nikola/plugins/command/check.py
diff options
context:
space:
mode:
Diffstat (limited to 'nikola/plugins/command/check.py')
-rw-r--r--nikola/plugins/command/check.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/nikola/plugins/command/check.py b/nikola/plugins/command/check.py
index 26db321..76571a0 100644
--- a/nikola/plugins/command/check.py
+++ b/nikola/plugins/command/check.py
@@ -51,7 +51,7 @@ def real_scan_files(site):
fname = task.split(':', 1)[-1]
task_fnames.add(fname)
# And now check that there are no non-target files
- for root, dirs, files in os.walk(output_folder):
+ for root, dirs, files in os.walk(output_folder, followlinks=True):
for src_name in files:
fname = os.path.join(root, src_name)
real_fnames.add(fname)
@@ -139,6 +139,8 @@ class CommandCheck(Command):
rv = False
self.whitelist = [re.compile(x) for x in self.site.config['LINK_CHECK_WHITELIST']]
base_url = urlparse(self.site.config['BASE_URL'])
+ self.existing_targets.add(self.site.config['SITE_URL'])
+ self.existing_targets.add(self.site.config['BASE_URL'])
url_type = self.site.config['URL_TYPE']
try:
filename = task.split(":")[-1]
@@ -166,11 +168,15 @@ class CommandCheck(Command):
elif url_type in ('full_path', 'absolute'):
target_filename = os.path.abspath(
os.path.join(os.path.dirname(filename), parsed.path))
- if parsed.path.endswith('/'): # abspath removes trailing slashes
+ if parsed.path in ['', '/']:
+ target_filename = os.path.join(self.site.config['OUTPUT_FOLDER'], self.site.config['INDEX_FILE'])
+ elif parsed.path.endswith('/'): # abspath removes trailing slashes
target_filename += '/{0}'.format(self.site.config['INDEX_FILE'])
if target_filename.startswith(base_url.path):
target_filename = target_filename[len(base_url.path):]
target_filename = os.path.join(self.site.config['OUTPUT_FOLDER'], target_filename)
+ if parsed.path in ['', '/']:
+ target_filename = os.path.join(self.site.config['OUTPUT_FOLDER'], self.site.config['INDEX_FILE'])
if any(re.match(x, target_filename) for x in self.whitelist):
continue
@@ -233,7 +239,7 @@ class CommandCheck(Command):
return failure
def clean_files(self):
- only_on_output, _ = self.real_scan_files()
+ only_on_output, _ = real_scan_files(self.site)
for f in only_on_output:
os.unlink(f)
return True