This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a commit to branch fix/30504-file-upload-checkbox-missing
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 38415837a59964539e78558b20ccc851dbd467d5
Author: Evan Rusackas <[email protected]>
AuthorDate: Thu Feb 19 13:30:30 2026 -0800

    fix(database): preserve engine_information when creating database connection
    
    When creating a new database connection, the "Allow file uploads to
    database" checkbox was missing. This was because:
    
    1. When selecting a database, engine_information (containing
       supports_file_upload) was set from the available databases list
    2. After creating the database, the POST response was used to update
       state via the Fetched action
    3. The POST response doesn't include engine_information, so the
       Fetched reducer was overwriting the state and losing it
    4. ExtraOptions checks engine_information.supports_file_upload to
       render the checkbox
    
    The fix preserves engine_information from the existing state when
    the Fetched action payload doesn't include it, following the same
    pattern used for engine, parameters, and ssh_tunnel fields.
    
    Fixes: #30504
    
    Co-Authored-By: Claude Opus 4.5 <[email protected]>
---
 .../databases/DatabaseModal/index.test.tsx         | 35 ++++++++++++++++++++++
 .../src/features/databases/DatabaseModal/index.tsx |  7 +++++
 2 files changed, 42 insertions(+)

diff --git 
a/superset-frontend/src/features/databases/DatabaseModal/index.test.tsx 
b/superset-frontend/src/features/databases/DatabaseModal/index.test.tsx
index 2cc9fbe1a87..1f52d773b48 100644
--- a/superset-frontend/src/features/databases/DatabaseModal/index.test.tsx
+++ b/superset-frontend/src/features/databases/DatabaseModal/index.test.tsx
@@ -2134,6 +2134,41 @@ describe('dbReducer', () => {
     });
   });
 
+  // Regression test for https://github.com/apache/superset/issues/30504
+  // When creating a database, the POST response doesn't include 
engine_information,
+  // but it should be preserved from the initial state set by DbSelected 
action.
+  test('it preserves engine_information when Fetched action payload lacks it', 
() => {
+    const initialState = {
+      database_name: 'TestDB',
+      engine: 'postgresql',
+      configuration_method: 'sqlalchemy_form' as const,
+      engine_information: {
+        supports_file_upload: true,
+        disable_ssh_tunneling: false,
+      },
+    };
+
+    // Simulate POST response that doesn't include engine_information
+    const action: DBReducerActionType = {
+      type: ActionType.Fetched,
+      payload: {
+        id: 123,
+        database_name: 'TestDB',
+        backend: 'postgresql',
+        configuration_method: 'sqlalchemy_form',
+        // Note: engine_information is NOT in POST response
+      },
+    };
+
+    const currentState = dbReducer(initialState, action);
+
+    // engine_information should be preserved from initialState
+    expect(currentState.engine_information).toEqual({
+      supports_file_upload: true,
+      disable_ssh_tunneling: false,
+    });
+  });
+
   test('it will add a SSH Tunnel config parameter', () => {
     const action: DBReducerActionType = {
       type: ActionType.ParametersSSHTunnelChange,
diff --git a/superset-frontend/src/features/databases/DatabaseModal/index.tsx 
b/superset-frontend/src/features/databases/DatabaseModal/index.tsx
index bbb4dd6bf5c..28c130ad2be 100644
--- a/superset-frontend/src/features/databases/DatabaseModal/index.tsx
+++ b/superset-frontend/src/features/databases/DatabaseModal/index.tsx
@@ -544,6 +544,10 @@ export function dbReducer(
             catalog: payloadCatalog,
           },
           // eslint-disable-next-line camelcase
+          engine_information:
+            action.payload.engine_information ||
+            trimmedState.engine_information,
+          // eslint-disable-next-line camelcase
           query_input,
         };
       }
@@ -555,6 +559,9 @@ export function dbReducer(
         parameters: action.payload.parameters || trimmedState.parameters,
         ssh_tunnel: action.payload.ssh_tunnel || trimmedState.ssh_tunnel,
         // eslint-disable-next-line camelcase
+        engine_information:
+          action.payload.engine_information || trimmedState.engine_information,
+        // eslint-disable-next-line camelcase
         query_input,
       };
 

Reply via email to