From 9ba9894247f7be25bd3bfa8b500f0369247590f1 Mon Sep 17 00:00:00 2001 From: Montassar Ghanmy Date: Mon, 4 Dec 2023 15:36:56 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20file=20name=20when=20conta?= =?UTF-8?q?ining=20a=20dot=20(#290)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../client/body/drive/modals/properties/index.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tdrive/frontend/src/app/views/client/body/drive/modals/properties/index.tsx b/tdrive/frontend/src/app/views/client/body/drive/modals/properties/index.tsx index f229cc29..1ba36c37 100644 --- a/tdrive/frontend/src/app/views/client/body/drive/modals/properties/index.tsx +++ b/tdrive/frontend/src/app/views/client/body/drive/modals/properties/index.tsx @@ -48,7 +48,9 @@ const PropertiesModalContent = ({ id, onClose }: { id: string; onClose: () => vo }, [item?.name]); return ( - + vo if (item) { let finalName = name; if (!item?.is_directory) { - const ext = item?.name.split('.').pop(); - finalName = name.split('.')[0] + (ext !== item?.name ? '.' + ext : ''); + const lastDotIndex = finalName.lastIndexOf('.'); + if (lastDotIndex !== -1) { + finalName = finalName.slice(0, lastDotIndex); + } } await update({ name: finalName }, id, item.parent_id); }