diff --git a/client/src/components/jobs-documents-gallery/jobs-document-gallery.reassign.component.jsx b/client/src/components/jobs-documents-gallery/jobs-document-gallery.reassign.component.jsx index 6d6a2f4a1..c2b7ff948 100644 --- a/client/src/components/jobs-documents-gallery/jobs-document-gallery.reassign.component.jsx +++ b/client/src/components/jobs-documents-gallery/jobs-document-gallery.reassign.component.jsx @@ -54,11 +54,20 @@ export default function JobsDocumentsGalleryReassign({ galleryImages }) { const res = await axios.post("/media/rename", { documents: selectedImages.map((i) => { - return { id: i.id, from: i.key, to: i.key.replace("null", jobid) }; + //Need to check if the current key folder is null, or another job. + const currentKeys = i.key.split("/"); + currentKeys[1] = jobid; + currentKeys.join("/"); + return { id: i.id, from: i.key, to: currentKeys.join("/") }; }), }); - console.log(res.data); + res.data + .filter((d) => d.error) + .forEach((d) => { + notification["error"]({ message: t("documents.errors.updating") }); + console.error("Error updating job document", d); + }); const proms = [];