From a7dc158f43738974cbec1b2c6b1506772789bef6 Mon Sep 17 00:00:00 2001 From: Daniel Gustafsson Date: Tue, 2 May 2017 09:03:06 +0200 Subject: [PATCH] Strip slashes from symbolic links in FTP pickle To avoid href's with double trailing slashes like url//, strip any trailing slash from symbolic links since the template appends slash in rendering. This handles links created like "ln -s foo/ bar". The issue is that the template gets confused with the "parent directory" link which with double trailing slashes leads to the same page. --- tools/ftp/spider_ftp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ftp/spider_ftp.py b/tools/ftp/spider_ftp.py index c9e50e9..d756e59 100755 --- a/tools/ftp/spider_ftp.py +++ b/tools/ftp/spider_ftp.py @@ -38,7 +38,7 @@ def parse_directory(dirname, rootlen): # This is a symbolic link mynode[f] = { 't': 'l', - 'd': os.readlink(fn), + 'd': (os.readlink(fn)).strip("/"), } else: # This is a subdirectory, recurse into it, unless it happens -- 2.13.0.rc0.45.ge2cb6ab.dirty