StrBufStripSlashes() we want to _strip_ trailing slashes, not append them.
authorWilfried Goesgens <dothebart@citadel.org>
Thu, 22 Mar 2012 23:41:01 +0000 (00:41 +0100)
committerWilfried Goesgens <dothebart@citadel.org>
Thu, 22 Mar 2012 23:41:01 +0000 (00:41 +0100)
libcitadel/lib/stringbuf.c

index bc54f82cfa4956ec5cd819e916a5cb1ad8094daa..1219401b42c9ed1b97827ed9f8c0d6f48f9d2897 100644 (file)
@@ -3862,7 +3862,6 @@ int FileSendChunked(FDIOBuffer *FDB, const char **Err)
 
 int FileRecvChunked(FDIOBuffer *FDB, const char **Err)
 {
-
 #ifdef LINUX_SENDFILE
        ssize_t sent, pipesize;
 
@@ -3887,6 +3886,7 @@ int FileRecvChunked(FDIOBuffer *FDB, const char **Err)
        FDB->ChunkSendRemain -= sent;
        return sent;
 #else
+
 #endif
        return 0;
 }
@@ -4628,9 +4628,10 @@ void StrBufStripSlashes(StrBuf *Dir, int RemoveTrailingSlash)
                        b++; a++;
                }
        }
-       if ((RemoveTrailingSlash) && (*(b - 1) != '/')){
-               *b = '/';
-               b++;
+       if ((RemoveTrailingSlash) &&
+           (b > Dir->buf) && 
+           (*(b - 1) == '/')){
+               b--;
        }
        *b = '\0';
        Dir->BufUsed = b - Dir->buf;