mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-15 20:01:03 +00:00
Detect filenames with spaces as internal links.
This commit is contained in:
parent
9ea35241c0
commit
90e0f4e5cc
4 changed files with 21 additions and 10 deletions
|
|
@ -3,6 +3,8 @@
|
||||||
Fixes:
|
Fixes:
|
||||||
- checking: Fix broken anchor checking.
|
- checking: Fix broken anchor checking.
|
||||||
Closes: SF bug #3140765
|
Closes: SF bug #3140765
|
||||||
|
- checking: Properly detect filenames with spaces as
|
||||||
|
internal links when given as start URL.
|
||||||
- logging: Allow Unicode strings to be written to stdout without
|
- logging: Allow Unicode strings to be written to stdout without
|
||||||
encoding errors.
|
encoding errors.
|
||||||
- gui: Reset statistics before each run.
|
- gui: Reset statistics before each run.
|
||||||
|
|
|
||||||
|
|
@ -266,14 +266,6 @@ class FileUrl (urlbase.UrlBase):
|
||||||
@return non-empty regex pattern or None
|
@return non-empty regex pattern or None
|
||||||
@rtype String or None
|
@rtype String or None
|
||||||
"""
|
"""
|
||||||
url = absolute_url(self.base_url, self.base_ref, self.parent_url)
|
if not self.url:
|
||||||
if not url:
|
|
||||||
return None
|
return None
|
||||||
parts = strformat.url_unicode_split(url)
|
return re.escape(self.url)
|
||||||
path = urlutil.splitparams(parts[2])[0]
|
|
||||||
segments = path.split('/')
|
|
||||||
if not self.is_directory():
|
|
||||||
# cut off filename to have a directory
|
|
||||||
segments = segments[:-1]
|
|
||||||
path = "/".join(segments)
|
|
||||||
return "file://%s" % re.escape(path)
|
|
||||||
|
|
|
||||||
1
tests/checker/data/a b/t.txt
Normal file
1
tests/checker/data/a b/t.txt
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
|
||||||
|
|
@ -129,3 +129,19 @@ class TestFile (LinkCheckTest):
|
||||||
u"valid",
|
u"valid",
|
||||||
]
|
]
|
||||||
self.direct(url, resultlines)
|
self.direct(url, resultlines)
|
||||||
|
|
||||||
|
def test_good_dir_space (self):
|
||||||
|
url = u"file://%(curdir)s/%(datadir)s/a b/" % self.get_attrs()
|
||||||
|
nurl = self.norm(url)
|
||||||
|
resultlines = [
|
||||||
|
u"url %s" % url,
|
||||||
|
u"cache key %s" % nurl,
|
||||||
|
u"real url %s" % nurl,
|
||||||
|
u"valid",
|
||||||
|
u"url t.txt",
|
||||||
|
u"cache key %st.txt" % nurl,
|
||||||
|
u"real url %st.txt" % nurl,
|
||||||
|
u"name t.txt",
|
||||||
|
u"valid",
|
||||||
|
]
|
||||||
|
self.direct(url, resultlines, recursionlevel=1)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue