From 40eb2f8504fdeb90972cdf8fae57fc39a8960969 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 17 May 2022 22:55:34 -0700 Subject: copy-path-rec: bug: trailing slash fail. * stdlib/copy-file.tl (copy-path-rec): When from-path has a trailing slash, the starts-with test fails, and the operation fails without doing anything. Let's just get rid of that test. It's probably only there because of the ad-hoc path munging that is calculating rel-path. Why don't we just use the rel-path function for that. --- stdlib/copy-file.tl | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'stdlib') diff --git a/stdlib/copy-file.tl b/stdlib/copy-file.tl index beab2fbc..bc670743 100644 --- a/stdlib/copy-file.tl +++ b/stdlib/copy-file.tl @@ -145,11 +145,8 @@ (lambda (path type stat . rest) (while t (catch** - (let* ((rel-path (let ((p [path (len from-dir)..:])) - (if (pure-rel-path-p p) p [p 1..:]))) + (let* ((rel-path (rel-path from-dir path)) (tgt-path (path-cat to-dir rel-path))) - (unless (starts-with from-dir path) - (error "~s: problem with directory traversal" 'copy-path)) (caseql* type ((ftw-dnr ftw-ns) (error "~s: unable to access ~s" 'copy-path path)) -- cgit v1.2.3