This repository was archived by the owner on Mar 10, 2020. It is now read-only.
  
  
  - 
                Notifications
    You must be signed in to change notification settings 
- Fork 105
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.
          
          
      
        
          +4
        
        
          −4
        
        
          
        
      
    
  
  
     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 hidden or 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 thattypeis a valid "type" for the item.Basically you have to specify the
longoption tolsin 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:
longoptiontypevalue (string of "directory" or "file") when you do specifylongtype: 0, size: 0, hash: ''if nolongoption is settypeas a number in the response iflongoption IS settype: 0, size: 0, hash: ''or convertingtypeto 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-ipfsto make it do the right thing instead of trying to maintain compatibility with an API that is something of a footgun.In this case
longshould 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 thelongoption.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 :)