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: gitlab file url not correctly encoded (#10996)

AkisAya566ab9261d04
diff --git a/api/core/tools/provider/builtin/gitlab/tools/gitlab_files.py b/api/core/tools/provider/builtin/gitlab/tools/gitlab_files.py
index 1e77f3c6dfc..ebcf13dc994 100644
--- a/api/core/tools/provider/builtin/gitlab/tools/gitlab_files.py
+++ b/api/core/tools/provider/builtin/gitlab/tools/gitlab_files.py
@@ -69,14 +69,16 @@ class GitlabFilesTool(BuiltinTool):
self.fetch_files(site_url, access_token, identifier, branch, item_path, is_repository)
)
else: # It's a file
+ encoded_item_path = urllib.parse.quote(item_path, safe="")
if is_repository:
file_url = (
f"{domain}/api/v4/projects/{encoded_identifier}/repository/files"
- f"/{item_path}/raw?ref={branch}"
+ f"/{encoded_item_path}/raw?ref={branch}"
)
else:
file_url = (
- f"{domain}/api/v4/projects/{project_id}/repository/files/{item_path}/raw?ref={branch}"
+ f"{domain}/api/v4/projects/{project_id}/repository/files"
+ f"{encoded_item_path}/raw?ref={branch}"
)
file_response = requests.get(file_url, headers=headers)