[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnurl] 29/222: FTP: remove trailing slash from path for LIST/MLSD
From: |
gnunet |
Subject: |
[gnurl] 29/222: FTP: remove trailing slash from path for LIST/MLSD |
Date: |
Thu, 07 Nov 2019 00:08:45 +0100 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit 1c02a4e8747defab6607e90173d294875eb73ba1
Author: Zenju <address@hidden>
AuthorDate: Fri Sep 13 17:32:04 2019 +0200
FTP: remove trailing slash from path for LIST/MLSD
Closes #4348
---
lib/ftp.c | 15 +++++++--------
tests/data/test1010 | 4 ++--
tests/data/test1149 | 2 +-
tests/data/test244 | 2 +-
tests/data/test539 | 2 +-
5 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/lib/ftp.c b/lib/ftp.c
index 00233a80d..068a1a024 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -1446,20 +1446,19 @@ static CURLcode ftp_state_list(struct connectdata *conn)
The other ftp_filemethods will CWD into dir/dir/ first and
then just do LIST (in that case: nothing to do here)
*/
- char *cmd, *lstArg, *slashPos;
+ char *cmd, *lstArg;
const char *inpath = ftp->path;
lstArg = NULL;
if((data->set.ftp_filemethod == FTPFILE_NOCWD) &&
inpath && inpath[0] && strchr(inpath, '/')) {
- size_t n = strlen(inpath);
+ /* chop off the file part if format is dir/file
+ otherwise remove the trailing slash for dir/dir/
+ and full paths like %2f/ except for / */
+ size_t n = strrchr(inpath, '/') - inpath;
+ if(n == 0)
+ ++n;
- /* Check if path does not end with /, as then we cut off the file part */
- if(inpath[n - 1] != '/') {
- /* chop off the file part if format is dir/dir/file */
- slashPos = strrchr(inpath, '/');
- n = slashPos - inpath;
- }
result = Curl_urldecode(data, inpath, n, &lstArg, NULL, TRUE);
if(result)
return result;
diff --git a/tests/data/test1010 b/tests/data/test1010
index b2083af7b..ef073f5e5 100644
--- a/tests/data/test1010
+++ b/tests/data/test1010
@@ -49,9 +49,9 @@ PASS address@hidden
PWD
EPSV
TYPE A
-LIST /list/this/path/1010/
+LIST /list/this/path/1010
EPSV
-LIST /list/this/path/1010/
+LIST /list/this/path/1010
QUIT
</protocol>
</verify>
diff --git a/tests/data/test1149 b/tests/data/test1149
index f826391e9..f0c297dc1 100644
--- a/tests/data/test1149
+++ b/tests/data/test1149
@@ -57,7 +57,7 @@ TYPE A
LIST
CWD /
EPSV
-LIST list/this/path/1149/
+LIST list/this/path/1149
QUIT
</protocol>
</verify>
diff --git a/tests/data/test244 b/tests/data/test244
index 8ce4b6346..080163dd1 100644
--- a/tests/data/test244
+++ b/tests/data/test244
@@ -47,7 +47,7 @@ PASS address@hidden
PWD
EPSV
TYPE A
-LIST fir#t/third/244/
+LIST fir#t/third/244
QUIT
</protocol>
</verify>
diff --git a/tests/data/test539 b/tests/data/test539
index e9aadd1f3..a69834012 100644
--- a/tests/data/test539
+++ b/tests/data/test539
@@ -64,7 +64,7 @@ SYST
CWD /
EPSV
TYPE A
-LIST path/to/the/file/539./
+LIST path/to/the/file/539.
QUIT
</protocol>
</verify>
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [gnurl] 16/222: CI: inintial github action job, (continued)
- [gnurl] 16/222: CI: inintial github action job, gnunet, 2019/11/06
- [gnurl] 20/222: doh: fix undefined behaviour and open up for gcc and clang optimization, gnunet, 2019/11/06
- [gnurl] 26/222: http2: relax verification of :authority in push promise requests, gnunet, 2019/11/06
- [gnurl] 27/222: url: cleanup dangling DOH request headers too, gnunet, 2019/11/06
- [gnurl] 28/222: mime: when disabled, avoid C99 macro, gnunet, 2019/11/06
- [gnurl] 32/222: url: only reuse TLS connections with matching pinning, gnunet, 2019/11/06
- [gnurl] 39/222: ftp: Expression 'ftpc->wait_data_conn' is always true, gnunet, 2019/11/06
- [gnurl] 46/222: easy: part of conditional expression is always true: !result, gnunet, 2019/11/06
- [gnurl] 30/222: http: merge two "case" statements, gnunet, 2019/11/06
- [gnurl] 36/222: doh: avoid truncating DNS QTYPE to lower octet, gnunet, 2019/11/06
- [gnurl] 29/222: FTP: remove trailing slash from path for LIST/MLSD,
gnunet <=
- [gnurl] 43/222: url: remove dead code, gnunet, 2019/11/06
- [gnurl] 42/222: url: part of expression is always true: (bundle->multiuse == 0), gnunet, 2019/11/06
- [gnurl] 44/222: version: Expression 'left > 1' is always true, gnunet, 2019/11/06
- [gnurl] 34/222: version: next release will be 7.67.0, gnunet, 2019/11/06
- [gnurl] 33/222: RELEASE-NOTES: synced, gnunet, 2019/11/06
- [gnurl] 31/222: README: add OSS-Fuzz badge [skip ci], gnunet, 2019/11/06
- [gnurl] 40/222: ftp: Expression 'ftpc->wait_data_conn' is always false, gnunet, 2019/11/06
- [gnurl] 45/222: netrc: part of conditional expression is always true: !done, gnunet, 2019/11/06
- [gnurl] 35/222: urlapi: CURLU_NO_AUTHORITY allows empty authority/host part, gnunet, 2019/11/06
- [gnurl] 38/222: ftp: part of conditional expression is always true: !result, gnunet, 2019/11/06