-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add --name new flag when ipfs adding from stdin #5399
Changes from 2 commits
514891d
19e3c12
b61dae3
0f4e84d
ad27614
76e8190
9898ba9
7de83f2
b7ea4bf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,6 +83,7 @@ type Adder struct { | |
RawLeaves bool | ||
Silent bool | ||
Wrap bool | ||
Name string | ||
NoCopy bool | ||
Chunker string | ||
root ipld.Node | ||
|
@@ -470,8 +471,13 @@ func (adder *Adder) addFile(file files.File) error { | |
return err | ||
} | ||
|
||
addFileName := file.FileName() | ||
if addFileName == "" && adder.Name != "" { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @keks WDYT about checking for an empty filename? I think this covers the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like there are several occasions where we use an empty string as file name. I just looked into this and it looks like when using stdin, te There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hello @keks ,i want to fix this bug.And i do not understand the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kjzz Sure! The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
addFileName = adder.Name | ||
adder.Name = "" | ||
} | ||
// patch it into the root | ||
return adder.addNode(dagnode, file.FileName()) | ||
return adder.addNode(dagnode, addFileName) | ||
} | ||
|
||
func (adder *Adder) addDir(dir files.File) error { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's change this to reflect that the option (with the new check) works only for
stdin
, e.g., "Assign a name if the file source is stdin" (or something like that, feel free to reword it).