This repository has been archived by the owner on Mar 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 124
fix: files ls tests #282
Open
hacdias
wants to merge
1
commit into
master
Choose a base branch
from
fix/files-ls
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
fix: files ls tests #282
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
type: 0, size: 0, hash: ''
sent by Go regardless - it's unfortunate thattype
is a valid "type" for the item.Basically you have to specify the
long
option tols
in order get these values otherwise you gettype: 0, size: 0, hash: ''
independent of whether the thing is a file or directory.You've added 'file' here for the item that is actually a directory and I'd argue that's even more confusing than
0
! 🤣@hacdias - if you're still up for the challenge (I know this PR is old now) I think that we can usefully do is:
long
optiontype
value (string of "directory" or "file") when you do specifylong
type: 0, size: 0, hash: ''
if nolong
option is settype
as a number in the response iflong
option IS settype: 0, size: 0, hash: ''
or convertingtype
to the correct stringBTW, it might be worth closing this PR and opening a new one as things have moved around in this repo significantly!
@achingbrain does that sound ok by you?
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.
I'm starting to think we should make the APIs do the right thing and submit a PR to
go-ipfs
to make it do the right thing instead of trying to maintain compatibility with an API that is something of a footgun.In this case
long
should not even be an option since when you are listing the files internally you have all the information you need to fill those fields in the response. If the CLI wants to throw some of that information away it's essentially UI concern.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.
So, @alanshaw @achingbrain how should I proceed then? I can remove the properties from the core MFS and ensure they have the correct value for
type
, keeping the HTTP API compatibility. Or I can always return everything independently of thelong
option.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.
@alanshaw please advise :)