Error with Uploadthing file renaming
I tried using both Rename types:
Whenever I try to send this request:
Example of originalDocument.fileKey:
Example of file name:
Error:
Rename || Rename[]Rename || Rename[]Whenever I try to send this request:
if (data.name !== originalDocument.name) {
await utapi.renameFiles({
key: originalDocument.fileKey,
newName: data.name,
});
} if (data.name !== originalDocument.name) {
await utapi.renameFiles({
key: originalDocument.fileKey,
newName: data.name,
});
}Example of originalDocument.fileKey:
<GUID>.pdf<GUID>.pdfExample of file name:
file name with space and ext.pdffile name with space and ext.pdfError:
[
⨯ UPLOADTHING 4:02:27 PM "Request failed:",
⨯ UPLOADTHING 4:02:27 PM {
⨯ UPLOADTHING 4:02:27 PM "error": "Request to https://uploadthing.com/api/renameFiles failed with status 400",
⨯ UPLOADTHING 4:02:27 PM "data": {
⨯ UPLOADTHING 4:02:27 PM "error": "Invalid request input",
⨯ UPLOADTHING 4:02:27 PM "data": [
⨯ UPLOADTHING 4:02:27 PM {
⨯ UPLOADTHING 4:02:27 PM "code": "custom",
⨯ UPLOADTHING 4:02:27 PM "message": "Must provide either fileKey or customId, but not both.",
⨯ UPLOADTHING 4:02:27 PM "path": [
⨯ UPLOADTHING 4:02:27 PM "updates",
⨯ UPLOADTHING 4:02:27 PM 0
⨯ UPLOADTHING 4:02:27 PM ]
⨯ UPLOADTHING 4:02:27 PM }
⨯ UPLOADTHING 4:02:27 PM ]
⨯ UPLOADTHING 4:02:27 PM },
⨯ UPLOADTHING 4:02:27 PM "input": "https://uploadthing.com/api/renameFiles",
⨯ UPLOADTHING 4:02:27 PM "_tag": "FetchError"
⨯ UPLOADTHING 4:02:27 PM }
⨯ UPLOADTHING 4:02:27 PM ][
⨯ UPLOADTHING 4:02:27 PM "Request failed:",
⨯ UPLOADTHING 4:02:27 PM {
⨯ UPLOADTHING 4:02:27 PM "error": "Request to https://uploadthing.com/api/renameFiles failed with status 400",
⨯ UPLOADTHING 4:02:27 PM "data": {
⨯ UPLOADTHING 4:02:27 PM "error": "Invalid request input",
⨯ UPLOADTHING 4:02:27 PM "data": [
⨯ UPLOADTHING 4:02:27 PM {
⨯ UPLOADTHING 4:02:27 PM "code": "custom",
⨯ UPLOADTHING 4:02:27 PM "message": "Must provide either fileKey or customId, but not both.",
⨯ UPLOADTHING 4:02:27 PM "path": [
⨯ UPLOADTHING 4:02:27 PM "updates",
⨯ UPLOADTHING 4:02:27 PM 0
⨯ UPLOADTHING 4:02:27 PM ]
⨯ UPLOADTHING 4:02:27 PM }
⨯ UPLOADTHING 4:02:27 PM ]
⨯ UPLOADTHING 4:02:27 PM },
⨯ UPLOADTHING 4:02:27 PM "input": "https://uploadthing.com/api/renameFiles",
⨯ UPLOADTHING 4:02:27 PM "_tag": "FetchError"
⨯ UPLOADTHING 4:02:27 PM }
⨯ UPLOADTHING 4:02:27 PM ]