init: Cleanup .minio/tmp directories recursively. Also takes care of cleaning up of parts directory during abortMultipartUpload. (#1532)

This commit is contained in:
Krishna Srinivas
2016-05-08 22:45:34 +05:30
committed by Harshavardhana
parent 3f51dd4fd4
commit a205aca6d2
4 changed files with 41 additions and 22 deletions

View File

@@ -22,6 +22,7 @@ import (
"errors"
"fmt"
"io"
"path"
"regexp"
"strings"
"unicode/utf8"
@@ -103,9 +104,13 @@ func retainSlash(s string) string {
return strings.TrimSuffix(s, slashSeparator) + slashSeparator
}
// pathJoin - path join.
// pathJoin - like path.Join() but retains trailing "/" of the last element
func pathJoin(s1 string, s2 string) string {
return retainSlash(s1) + s2
trailingSlash := ""
if strings.HasSuffix(s2, slashSeparator) {
trailingSlash = "/"
}
return path.Join(s1, s2) + trailingSlash
}
// Create an s3 compatible MD5sum for complete multipart transaction.