diff --git a/src/pages/api/resources/photo/[id].tsx b/src/pages/api/resources/photo/[id].tsx index eb945c4..73dfb12 100644 --- a/src/pages/api/resources/photo/[id].tsx +++ b/src/pages/api/resources/photo/[id].tsx @@ -60,7 +60,9 @@ const handler: NextApiHandler = async (req, res) => { }, data: { photo: { - name: getFileName((await uploadPhoto).filepath), + name: getFileName( + (await uploadPhoto).originalFilename ?? "resource ICON" + ), data: photoBuffer, }, }, diff --git a/src/pages/resources/[id]/edit.tsx b/src/pages/resources/[id]/edit.tsx index 3ee4ea7..a8d9d15 100644 --- a/src/pages/resources/[id]/edit.tsx +++ b/src/pages/resources/[id]/edit.tsx @@ -60,9 +60,6 @@ const EditResourcePage = ( }); const onSubmit: SubmitHandler = async (data) => { - // TODO: Fix file upload, currently it is not updating correctly on the server side - // May also need to look into re-rendering static pages when icon changes - // Also need to add authentication of route! if (updateIconFile) { const data = new FormData(); data.append("photo", updateIconFile); @@ -75,8 +72,6 @@ const EditResourcePage = ( } ); - console.log("uploading icon"); - if (uploadResponse.status !== 200) { setServerError( "Failed uploading resource icon file. Changes did not save!"