Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion apps/folders/serializers/folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,4 +331,5 @@ def get_folder_tree(self,

TreeSerializer = get_folder_tree_serializer(self.data.get('source')) # noqa
serializer = TreeSerializer(nodes, many=True)
return [d for d in serializer.data if d.get('id') == d.get('workspace_id')] # 这是可序列化的字典

return [d for d in serializer.data if d.get('id') == d.get('workspace_id')] if name is None else serializer.data # 这是可序列化的字典

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There are two main improvements recommended:

  1. Null Check: Add a null check before the data processing code. This ensures that the function can handle cases where name might be None gracefully.

  •    return [d for d in serializer.data if d.get('id') == d.get('workspace_id')]
    
  •   if not name:
    
  •       return [d for d in serializer.data if d.get('id') == d.get('workspace_id')]
    
  •   ...
    
    
    
  1. Return All Data When Name Is Not Provided: Ensure that when name is provided (i.e., non-NaN), it returns all serializable objects from the serializer without filtering based on the workspace ID.

This changes will make the function more robust and flexible, handling both regular use cases and edge cases like missing or unknown names.

Loading