From f6dbc97d77f79b6b3348ac084bfcc5b8e272652e Mon Sep 17 00:00:00 2001 From: Gabriel Almeida Date: Wed, 31 May 2023 01:14:30 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(endpoints.tsx):=20change=20r?= =?UTF-8?q?eturned=20key=20from=20'filename'=20to=20'file=5Fpath'=20for=20?= =?UTF-8?q?consistency=20=F0=9F=90=9B=20fix(inputFileComponent):=20update?= =?UTF-8?q?=20the=20key=20used=20to=20set=20the=20file=20path=20to=20match?= =?UTF-8?q?=20the=20change=20in=20the=20backend=20The=20key=20returned=20b?= =?UTF-8?q?y=20the=20endpoint=20was=20changed=20from=20'filename'=20to=20'?= =?UTF-8?q?file=5Fpath'=20for=20consistency.=20The=20key=20used=20to=20set?= =?UTF-8?q?=20the=20file=20path=20in=20the=20frontend=20was=20updated=20to?= =?UTF-8?q?=20match=20the=20change=20in=20the=20backend.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/api/endpoints.py | 2 +- src/frontend/src/components/inputFileComponent/index.tsx | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/backend/langflow/api/endpoints.py b/src/backend/langflow/api/endpoints.py index 2d4e96abf..d01d18064 100644 --- a/src/backend/langflow/api/endpoints.py +++ b/src/backend/langflow/api/endpoints.py @@ -43,7 +43,7 @@ async def create_upload_file(file: UploadFile, client_id: str): # Cache file file_path = save_uploaded_file(file.file, file_name=client_id) - return {"filename": file_path} + return {"file_path": file_path} # get endpoint to return version of langflow diff --git a/src/frontend/src/components/inputFileComponent/index.tsx b/src/frontend/src/components/inputFileComponent/index.tsx index 89969fc06..e6e9c9e33 100644 --- a/src/frontend/src/components/inputFileComponent/index.tsx +++ b/src/frontend/src/components/inputFileComponent/index.tsx @@ -59,15 +59,15 @@ export default function InputFileComponent({ .then((data) => { console.log("File uploaded successfully"); // Get the file name from the response - const { filename } = data; - console.log("File name:", filename); + const { file_path } = data; + console.log("File name:", file_path); // Update the state and callback with the name of the file // sets the value to the user setMyValue(file.name); onChange(file.name); // sets the value that goes to the backend - onFileChange(filename); + onFileChange(file_path); }) .catch(() => { console.error("Error occurred while uploading file");