mirror of
https://github.com/minio/minio.git
synced 2025-11-20 18:06:10 -05:00
Add cross-version remapped merges to xl-meta (#19765)
Adds `-xver` which can be used with `-export` and `-combine` to attempt to combine files across versions if data is suspected to be the same. Overlapping data is compared. Bonus: Make `inspect` accept wildcards.
This commit is contained in:
@@ -31,6 +31,8 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/klauspost/filepathx"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -68,7 +70,7 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
var inputFileName, outputFileName string
|
||||
var inputs []string
|
||||
|
||||
// Parse parameters
|
||||
switch {
|
||||
@@ -83,22 +85,34 @@ func main() {
|
||||
fatalErr(err)
|
||||
}
|
||||
fatalErr(json.Unmarshal(got, &input))
|
||||
inputFileName = input.File
|
||||
inputs = []string{input.File}
|
||||
*keyHex = input.Key
|
||||
case len(flag.Args()) == 1:
|
||||
inputFileName = flag.Args()[0]
|
||||
var err error
|
||||
inputs, err = filepathx.Glob(flag.Args()[0])
|
||||
fatalErr(err)
|
||||
default:
|
||||
flag.Usage()
|
||||
fatalIf(true, "Only 1 file can be decrypted")
|
||||
os.Exit(1)
|
||||
}
|
||||
for _, input := range inputs {
|
||||
processFile(input, privateKey)
|
||||
}
|
||||
}
|
||||
|
||||
func processFile(inputFileName string, privateKey []byte) {
|
||||
// Calculate the output file name
|
||||
var outputFileName string
|
||||
switch {
|
||||
case strings.HasSuffix(inputFileName, ".enc"):
|
||||
outputFileName = strings.TrimSuffix(inputFileName, ".enc") + ".zip"
|
||||
case strings.HasSuffix(inputFileName, ".zip"):
|
||||
outputFileName = strings.TrimSuffix(inputFileName, ".zip") + ".decrypted.zip"
|
||||
case strings.Contains(inputFileName, ".enc."):
|
||||
outputFileName = strings.Replace(inputFileName, ".enc.", ".", 1) + ".zip"
|
||||
default:
|
||||
outputFileName = inputFileName + ".decrypted"
|
||||
}
|
||||
|
||||
// Backup any already existing output file
|
||||
|
||||
Reference in New Issue
Block a user