diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-05-17 22:55:34 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-05-17 22:55:34 -0700 |
commit | 40eb2f8504fdeb90972cdf8fae57fc39a8960969 (patch) | |
tree | 9acfd09efb26c29b4f85c22bbd2cfca04ce130ce /stdlib | |
parent | f255d4cfaf866ced7a5fb2f4af4681d96a069b4b (diff) | |
download | txr-40eb2f8504fdeb90972cdf8fae57fc39a8960969.tar.gz txr-40eb2f8504fdeb90972cdf8fae57fc39a8960969.tar.bz2 txr-40eb2f8504fdeb90972cdf8fae57fc39a8960969.zip |
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.
Diffstat (limited to 'stdlib')
-rw-r--r-- | stdlib/copy-file.tl | 5 |
1 files changed, 1 insertions, 4 deletions
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)) |