mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-15 00:16:04 +08:00
fix: gitlab file url not correctly encoded (#10996)
This commit is contained in:
parent
1cdadfdece
commit
566ab9261d
@ -69,14 +69,16 @@ class GitlabFilesTool(BuiltinTool):
|
|||||||
self.fetch_files(site_url, access_token, identifier, branch, item_path, is_repository)
|
self.fetch_files(site_url, access_token, identifier, branch, item_path, is_repository)
|
||||||
)
|
)
|
||||||
else: # It's a file
|
else: # It's a file
|
||||||
|
encoded_item_path = urllib.parse.quote(item_path, safe="")
|
||||||
if is_repository:
|
if is_repository:
|
||||||
file_url = (
|
file_url = (
|
||||||
f"{domain}/api/v4/projects/{encoded_identifier}/repository/files"
|
f"{domain}/api/v4/projects/{encoded_identifier}/repository/files"
|
||||||
f"/{item_path}/raw?ref={branch}"
|
f"/{encoded_item_path}/raw?ref={branch}"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
file_url = (
|
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)
|
file_response = requests.get(file_url, headers=headers)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user