Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Better storage file renaming (#21231)

Terry Suttondfe0fe0340c7
diff --git a/apps/studio/components/to-be-cleaned/Storage/StorageExplorer/FileExplorerRowEditing.tsx b/apps/studio/components/to-be-cleaned/Storage/StorageExplorer/FileExplorerRowEditing.tsx
index bf55400b800..176f0388d6a 100644
--- a/apps/studio/components/to-be-cleaned/Storage/StorageExplorer/FileExplorerRowEditing.tsx
+++ b/apps/studio/components/to-be-cleaned/Storage/StorageExplorer/FileExplorerRowEditing.tsx
@@ -34,7 +34,13 @@ const FileExplorerRowEditing = ({ item, view, columnIndex }: FileExplorerRowEdit
}
useEffect(() => {
- if (inputRef.current) inputRef.current.select()
+ // select just the name of the file without the extension
+ if (inputRef.current) {
+ const dotIndex = item.name.lastIndexOf('.')
+ const selectionEnd = dotIndex !== -1 ? dotIndex : item.name.length
+ inputRef.current.setSelectionRange(0, selectionEnd)
+ inputRef.current.focus()
+ }
// [Joshen] Esc should revert changes
const handleEsc = (event: KeyboardEvent) => {