Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: default online drive prefix to root (#33912)

wangji09237de3c2938c60
diff --git a/api/core/datasource/entities/datasource_entities.py b/api/core/datasource/entities/datasource_entities.py
index 29f995cf2ec..1da7abe5d83 100644
--- a/api/core/datasource/entities/datasource_entities.py
+++ b/api/core/datasource/entities/datasource_entities.py
@@ -486,7 +486,7 @@ class OnlineDriveBrowseFilesRequest(BaseModel):
"""
bucket: str | None = Field(None, description="The file bucket")
- prefix: str = Field(..., description="The parent folder ID")
+ prefix: str = Field(default="", description="The prefix to browse. An empty string means the root folder.")
max_keys: int = Field(20, description="Page size for pagination")
next_page_parameters: dict[str, Any] | None = Field(None, description="Parameters for fetching the next page")
diff --git a/api/tests/unit_tests/core/datasource/entities/test_datasource_entities.py b/api/tests/unit_tests/core/datasource/entities/test_datasource_entities.py
index 988183bc4e7..c1ce8b5ad4a 100644
--- a/api/tests/unit_tests/core/datasource/entities/test_datasource_entities.py
+++ b/api/tests/unit_tests/core/datasource/entities/test_datasource_entities.py
@@ -382,6 +382,12 @@ def test_online_drive_models():
bucket = OnlineDriveFileBucket(bucket="b1", files=[file], is_truncated=False, next_page_parameters=None)
assert bucket.bucket == "b1"
+ req_default = OnlineDriveBrowseFilesRequest()
+ assert req_default.bucket is None
+ assert req_default.prefix == ""
+ assert req_default.max_keys == 20
+ assert req_default.next_page_parameters is None
+
req = OnlineDriveBrowseFilesRequest(bucket="b1", prefix="folder1", max_keys=10, next_page_parameters=None)
assert req.prefix == "folder1"