use file fullpath to judge file name
License: MIT Signed-off-by: Kejie Zhang <601172892@qq.com>
Kejie Zhang committed
Sep 5, 2018 at 09:25 UTC
b61dae36f3a5a294377abce6d9f2ffe26d50c8c8
2 files changed
+2
-2
core/commands/add.go
+1
-1
@@ -117,7 +117,7 @@ You can now check what blocks have been created by:
117
cmdkit.BoolOption(trickleOptionName, "t", "Use trickle-dag format for dag generation."),
118
cmdkit.BoolOption(onlyHashOptionName, "n", "Only chunk and hash - do not write to disk."),
119
cmdkit.BoolOption(wrapOptionName, "w", "Wrap files with a directory object."),
120
- cmdkit.StringOption(pathName, "Assign path name when use wrap-with-directory option"),
120
+ cmdkit.StringOption(pathName, "Assign a name if the file source is stdin."),
121
cmdkit.BoolOption(hiddenOptionName, "H", "Include files that are hidden. Only takes effect on recursive add."),
122
cmdkit.StringOption(chunkerOptionName, "s", "Chunking algorithm, size-[bytes] or rabin-[min]-[avg]-[max]").WithDefault("size-262144"),
123
cmdkit.BoolOption(pinOptionName, "Pin this object when adding.").WithDefault(true),
core/coreunix/add.go
+1
-1
@@ -472,7 +472,7 @@ func (adder *Adder) addFile(file files.File) error {
472
}
473
474
addFileName := file.FileName()
475
- if addFileName == "" && adder.Name != "" {
475
+ if (file.FullPath() == "/dev/stdin" || file.FullPath() == "") && adder.Name != "" {
476
addFileName = adder.Name
477
adder.Name = ""
478
}