Skip to content
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

Fix wrong added filename #4919

Closed
wants to merge 1 commit into from
Closed

Fix wrong added filename #4919

wants to merge 1 commit into from

Conversation

camelmasa
Copy link
Contributor

@camelmasa camelmasa commented Apr 4, 2018

I think It looks files.NewSerialFile's first argument is wrong.

Note: The coreunix.AddR will be removed after implemented Core API (Ref: #4562).

@camelmasa camelmasa requested a review from Kubuxu as a code owner April 4, 2018 10:49
@Kubuxu
Copy link
Member

Kubuxu commented Apr 4, 2018

I am wondering why no tests have detected it.

License: MIT
Signed-off-by: Masahiro Saito <camelmasa@gmail.com>
@camelmasa
Copy link
Contributor Author

camelmasa commented Apr 4, 2018

@Kubuxu Thanks for checking.

I just changed test data directory path from test_data to test/data.

Case of original code, Returned value was changed after I just change the directory path.
Original test case was couldn't detect error when the directory was nested like aaa/bbb.

@@ -336,7 +337,10 @@ func AddR(n *core.IpfsNode, root string) (key string, err error) {
return "", err
}

f, err := files.NewSerialFile(root, root, false, stat)
segs := strings.Split(root, "/")
name := segs[len(segs)-1]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use name := filepath.Base(root) instead of string splitting.
Filepath is aware of system specific separators.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@Kubuxu Kubuxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One system compatibility replated change.

@whyrusleeping
Copy link
Member

Since the author has been gone for ~1mo, can someone else take over this changeset? cc @djdv maybe?

@djdv
Copy link
Contributor

djdv commented Jun 29, 2018

Amended in: #5167

@djdv djdv closed this Jun 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants