bito-code-review[bot] commented on code in PR #35828:
URL: https://github.com/apache/superset/pull/35828#discussion_r2459400891


##########
cypress/e2e/dashboards/export-special-chars.cy.js:
##########
@@ -0,0 +1,175 @@
+// cypress/e2e/dashboards/export-special-chars.cy.js

Review Comment:
   
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Deprecated Cypress framework usage</b></div>
   <div id="fix">
   
   This test file uses Cypress for E2E testing, but Cypress is deprecated in 
Superset and is actively being migrated away from in favor of Playwright. This 
will cause test failures when Cypress is removed from the project. The test 
should be converted to use Playwright framework instead, and the file should be 
moved to the appropriate Playwright test directory (e.g., 
superset-frontend/playwright/tests/ or tests/integration/).
   </div>
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ```
    -// cypress/e2e/dashboards/export-special-chars.cy.js
    -// Superset Issue #31158 - E2E Test for Dashboard Export with Special 
Characters
    -
    -describe("Dashboard Export API - Issue #31158", () => {
    -  beforeEach(() => {
    -    // We test the API directly without UI since we're in headless 
environment
    -    // In a real Superset instance, these would interact with the UI
    -    cy.session("admin", () => {
    -      cy.visit("http://localhost:8088/login/";);
    -      cy.get('input[id="username"]').type("admin");
    -      cy.get('input[id="password"]').type("admin");
    -      cy.get("button[type='submit']").click();
    -      cy.url().should("include", "/dashboard/list");
    -    });
    -  });
    -
    -  it("should properly encode dashboard export filename with special 
characters", () => {
    -    // Test the export API endpoint directly
    -    // This verifies the fix for issue #31158
    -
    -    // Test Case 1: Normal dashboard name (baseline)
    -    cy.request({
    -      method: "GET",
    -      url: "http://localhost:8088/api/v1/dashboard/export";,
    -      headers: {
    -        Authorization: "Bearer admin",
    -      },
    -    }).then((response) => {
    -      expect(response.status).to.eq(200);
    -      
expect(response.headers["content-type"]).to.include("application/zip");
    -
    -      // Verify Content-Disposition header is present
    -      const contentDisposition = response.headers["content-disposition"];
    -      expect(contentDisposition).to.exist;
    -      expect(contentDisposition).to.include("attachment");
    -      expect(contentDisposition).to.include("filename=");
    -
    -      cy.log("✅ Normal export works");
    -    });
    -  });
    -
    -  it("should handle dashboard names with brackets [2024]", () => {
    -    // Test that quote() properly encodes brackets
    -    cy.request({
    -      method: "GET",
    -      url: "http://localhost:8088/api/v1/dashboard/export";,
    -      query: { q: "[1]" }, // Export dashboard with ID 1
    -      headers: {
    -        Authorization: "Bearer admin",
    -      },
    -    }).then((response) => {
    -      expect(response.status).to.eq(200);
    -
    -      const contentDisposition = response.headers["content-disposition"];
    -
    -      // Verify brackets are either not present or properly encoded
    -      if (contentDisposition.includes("[")) {
    -        // If brackets somehow get through, they should be percent-encoded
    -        expect(contentDisposition).to.include("%5B");
    -        cy.log("✅ Brackets properly encoded as %5B");
    -      }
    -
    -      // ZIP content should be valid
    -      expect(response.body).to.be.instanceof(ArrayBuffer);
    -      expect(response.body.byteLength).to.be.greaterThan(0);
    -
    -      cy.log("✅ Brackets in filename handled correctly");
    -    });
    -  });
    -
    -  it("should verify Content-Disposition header format", () => {
    -    // This test verifies the HTTP header format is correct for downloads
    -    cy.request({
    -      method: "GET",
    -      url: "http://localhost:8088/api/v1/dashboard/export?q=[1]";,
    -      headers: {
    -        Authorization: "Bearer admin",
    -      },
    -      failOnStatusCode: false,
    -    }).then((response) => {
    -      if (response.status === 200) {
    -        const disposition = response.headers["content-disposition"];
    -
    -        // Verify proper RFC 2183/2184 format
    -        expect(disposition).to.match(/^attachment/);
    -
    -        // Filename should be present and properly quoted
    -        expect(disposition).to.include('filename=');
    -
    -        // Dangerous HTTP header characters should be encoded
    -        expect(disposition).not.to.include(';');
    -        expect(disposition).not.to.include(',');
    -        expect(disposition).not.to.include('\"');
    -
    -        cy.log("✅ Content-Disposition header properly formatted");
    -        cy.log(`   Header: ${disposition.substring(0, 80)}...`);
    -      }
    -    });
    -  });
    -
    -  it("should export valid ZIP file", () => {
    -    // Test that the exported file is a valid ZIP
    -    cy.request({
    -      method: "GET",
    -      url: "http://localhost:8088/api/v1/dashboard/export?q=[1]";,
    -      headers: {
    -        Authorization: "Bearer admin",
    -      },
    -      responseType: "arraybuffer",
    -    }).then((response) => {
    -      if (response.status === 200) {
    -        // Check ZIP magic bytes (PK\x03\x04)
    -        const view = new Uint8Array(response.body);
    -        const header = 
`${String.fromCharCode(view[0])}${String.fromCharCode(
    -          view[1]
    -        )}${String.fromCharCode(view[2])}${String.fromCharCode(view[3])}`;
    -
    -        expect(header).to.equal("PK\x03\x04");
    -        cy.log("✅ ZIP file has valid magic bytes");
    -
    -        // File should have reasonable size (>100 bytes)
    -        expect(response.body.byteLength).to.be.greaterThan(100);
    -        cy.log(`✅ ZIP file size: ${response.body.byteLength} bytes`);
    -      }
    -    });
    -  });
    -
    -  it("should handle URL encoding without breaking dashboard content", () 
=> {
    -    // Verify that quote() encoding doesn't affect ZIP contents
    -    cy.request({
    -      method: "GET",
    -      url: "http://localhost:8088/api/v1/dashboard/export?q=[1]";,
    -      headers: {
    -        Authorization: "Bearer admin",
    -      },
    -      responseType: "arraybuffer",
    -    }).then((response) => {
    -      if (response.status === 200) {
    -        // Convert to text to verify YAML content is intact
    -        const buffer = new Uint8Array(response.body);
    -        const compressed = buffer.buffer;
    -
    -        // ZIP should contain readable YAML files (we can check for 
\"YAML\" text)
    -        // This is a basic content verification
    -        expect(buffer.length).to.be.greaterThan(0);
    -
    -        cy.log("✅ Export contains dashboard content");
    -      }
    -    });
    -  });
    -});
    -
    -/**
    - * MANUAL CYPRESS TEST EXECUTION
    - *
    - * To run these tests manually:
    - *
    - * 1. Start Superset (docker-compose up or local installation)
    - * 2. From superset directory:
    - *    npx cypress run --spec 
\"cypress/e2e/dashboards/export-special-chars.cy.js\"
    - *
    - * Or open Cypress UI:
    - *    npx cypress open
    - *
    - * Expected Results:
    - * ✅ All 5 tests pass
    - * ✅ Status codes: 200 OK
    - * ✅ Content-Type: application/zip
    - * ✅ ZIP files are valid (magic bytes OK)
    - * ✅ Content-Disposition headers properly formatted
    - *
    - * These tests verify that the fix for issue #31158 works correctly
    - * by ensuring special characters are properly URL-encoded in HTTP headers.
    - */
    +// tests/integration/dashboards/export-special-chars.test.ts
    +// Superset Issue #31158 - E2E Test for Dashboard Export with Special 
Characters
    +
    +import { test, expect } from '@playwright/test';
    +
    +test.describe('Dashboard Export API - Issue #31158', () => {
    +  test.beforeEach(async ({ page }) => {
    +    // Login to Superset
    +    await page.goto('http://localhost:8088/login/');
    +    await page.fill('input[id="username"]', 'admin');
    +    await page.fill('input[id="password"]', 'admin');
    +    await page.click('button[type="submit"]');
    +    await expect(page).toHaveURL(/.*\/dashboard\/list/);
    +  });
    +
    +  test('should properly encode dashboard export filename with special 
characters', async ({ request }) => {
    +    // Test the export API endpoint directly
    +    // This verifies the fix for issue #31158
    +
    +    // Test Case 1: Normal dashboard name (baseline)
    +    const response = await 
request.get('http://localhost:8088/api/v1/dashboard/export', {
    +      headers: {
    +        Authorization: 'Bearer admin',
    +      },
    +    });
    +
    +    expect(response.status()).toBe(200);
    +    
expect(response.headers()['content-type']).toContain('application/zip');
    +
    +    // Verify Content-Disposition header is present
    +    const contentDisposition = response.headers()['content-disposition'];
    +    expect(contentDisposition).toBeDefined();
    +    expect(contentDisposition).toContain('attachment');
    +    expect(contentDisposition).toContain('filename=');
    +
    +    console.log('✅ Normal export works');
    +  });
    +
    +  test('should handle dashboard names with brackets [2024]', async ({ 
request }) => {
    +    // Test that quote() properly encodes brackets
    +    const response = await 
request.get('http://localhost:8088/api/v1/dashboard/export?q=[1]', {
    +      headers: {
    +        Authorization: 'Bearer admin',
    +      },
    +    });
    +
    +    expect(response.status()).toBe(200);
    +
    +    const contentDisposition = response.headers()['content-disposition'];
    +
    +    // Verify brackets are either not present or properly encoded
    +    if (contentDisposition.includes('[')) {
    +      // If brackets somehow get through, they should be percent-encoded
    +      expect(contentDisposition).toContain('%5B');
    +      console.log('✅ Brackets properly encoded as %5B');
    +    }
    +
    +    // ZIP content should be valid
    +    const body = await response.body();
    +    expect(body).toBeInstanceOf(Buffer);
    +    expect(body.length).toBeGreaterThan(0);
    +
    +    console.log('✅ Brackets in filename handled correctly');
    +  });
    +
    +  test('should verify Content-Disposition header format', async ({ request 
}) => {
    +    // This test verifies the HTTP header format is correct for downloads
    +    const response = await 
request.get('http://localhost:8088/api/v1/dashboard/export?q=[1]', {
    +      headers: {
    +        Authorization: 'Bearer admin',
    +      },
    +    });
    +
    +    if (response.status() === 200) {
    +      const disposition = response.headers()['content-disposition'];
    +
    +      // Verify proper RFC 2183/2184 format
    +      expect(disposition).toMatch(/^attachment/);
    +
    +      // Filename should be present and properly quoted
    +      expect(disposition).toContain('filename=');
    +
    +      // Dangerous HTTP header characters should be encoded
    +      expect(disposition).not.toContain(';');
    +      expect(disposition).not.toContain(',');
    +      expect(disposition).not.toContain('"');
    +
    +      console.log('✅ Content-Disposition header properly formatted');
    +      console.log(`   Header: ${disposition.substring(0, 80)}...`);
    +    }
    +  });
    +
    +  test('should export valid ZIP file', async ({ request }) => {
    +    // Test that the exported file is a valid ZIP
    +    const response = await 
request.get('http://localhost:8088/api/v1/dashboard/export?q=[1]', {
    +      headers: {
    +        Authorization: 'Bearer admin',
    +      },
    +    });
    +
    +    if (response.status() === 200) {
    +      // Check ZIP magic bytes (PK\x03\x04)
    +      const body = await response.body();
    +      const view = new Uint8Array(body);
    +      const header = `${String.fromCharCode(view[0])}${String.fromCharCode(
    +        view[1]
    +      )}${String.fromCharCode(view[2])}${String.fromCharCode(view[3])}`;
    +
    +      expect(header).toBe('PK\x03\x04');
    +      console.log('✅ ZIP file has valid magic bytes');
    +
    +      // File should have reasonable size (>100 bytes)
    +      expect(body.length).toBeGreaterThan(100);
    +      console.log(`✅ ZIP file size: ${body.length} bytes`);
    +    }
    +  });
    +
    +  test('should handle URL encoding without breaking dashboard content', 
async ({ request }) => {
    +    // Verify that quote() encoding doesn't affect ZIP contents
    +    const response = await 
request.get('http://localhost:8088/api/v1/dashboard/export?q=[1]', {
    +      headers: {
    +        Authorization: 'Bearer admin',
    +      },
    +    });
    +
    +    if (response.status() === 200) {
    +      // Convert to text to verify YAML content is intact
    +      const body = await response.body();
    +      const buffer = new Uint8Array(body);
    +
    +      // ZIP should contain readable YAML files (we can check for \"YAML\" 
text)
    +      // This is a basic content verification
    +      expect(buffer.length).toBeGreaterThan(0);
    +
    +      console.log('✅ Export contains dashboard content');
    +    }
    +  });
    +});
    +
    +/**
    + * MANUAL PLAYWRIGHT TEST EXECUTION
    + *
    + * To run these tests manually:
    + *
    + * 1. Start Superset (docker-compose up or local installation)
    + * 2. From superset directory:
    + *    npx playwright test 
tests/integration/dashboards/export-special-chars.test.ts
    + *
    + * Or run with UI:
    + *    npx playwright test --ui
    + *
    + * Expected Results:
    + * ✅ All 5 tests pass
    + * ✅ Status codes: 200 OK
    + * ✅ Content-Type: application/zip
    + * ✅ ZIP files are valid (magic bytes OK)
    + * ✅ Content-Disposition headers properly formatted
    + *
    + * These tests verify that the fix for issue #31158 works correctly
    + * by ensuring special characters are properly URL-encoded in HTTP headers.
    + */
   ```
   
   </div>
   </details>
   
   
   </div>
   
   <details>
   <summary><b>Citations</b></summary>
   <ul>
   
   <li>
   Rule Violated: <a 
href="https://github.com/apache/superset/blob/a86e253/.cursor/rules/dev-standard.mdc#L24";>dev-standard.mdc:24</a>
   </li>
   
   <li>
   Rule Violated: <a 
href="https://github.com/apache/superset/blob/a86e253/AGENTS.md#L20";>AGENTS.md:20</a>
   </li>
   
   <li>
   Rule Violated: <a 
href="https://github.com/apache/superset/blob/a86e253/AGENTS.md#L19";>AGENTS.md:19</a>
   </li>
   
   </ul>
   </details>
   
   
   
   
   <small><i>Code Review Run <a 
href=https://github.com/apache/superset/pull/35828#issuecomment-3441867437>#ddf90c</a></i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



##########
tests/integration_tests/dashboard_export_test.py:
##########
@@ -0,0 +1,173 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""
+Tests for dashboard export functionality
+Issue #31158: URL-encoding of special characters in export filenames
+"""
+
+import io
+import zipfile
+from typing import Iterator
+
+import pytest
+from flask.testing import FlaskClient
+
+from superset import db
+from superset.models.dashboard import Dashboard
+from tests.integration_tests.constants import ADMIN_USERNAME
+
+
+class TestDashboardExport:
+    """Test dashboard export endpoint with special characters."""
+
+    @pytest.fixture
+    def setup_dashboards(self) -> Iterator[tuple[Dashboard, Dashboard, 
Dashboard]]:
+        """Create dashboards with special characters in names."""
+        # Baseline dashboard (normal name)
+        dashboard_normal = Dashboard(
+            dashboard_title="Simple Dashboard",
+            slug="simple-dashboard",
+        )
+        db.session.add(dashboard_normal)
+        db.session.flush()
+
+        # Dashboard with brackets
+        dashboard_brackets = Dashboard(
+            dashboard_title="Dashboard [2024] - Q4 Report",
+            slug="dashboard-2024-q4",
+        )
+        db.session.add(dashboard_brackets)
+        db.session.flush()
+
+        # Dashboard with special chars
+        dashboard_special = Dashboard(
+            dashboard_title="Report/Q4 & Analysis™",
+            slug="report-q4-analysis",
+        )
+        db.session.add(dashboard_special)
+        db.session.flush()
+
+        yield dashboard_normal, dashboard_brackets, dashboard_special
+
+        db.session.delete(dashboard_normal)
+        db.session.delete(dashboard_brackets)
+        db.session.delete(dashboard_special)
+        db.session.commit()
+
+    def test_export_dashboard_with_normal_name(
+        self,
+        client: FlaskClient,
+        setup_dashboards: tuple[Dashboard, Dashboard, Dashboard],
+    ) -> None:
+        """Test exporting dashboard with normal name (baseline)."""
+        dashboard, _, _ = setup_dashboards
+
+        response = client.get(
+            f"/api/v1/dashboard/export?q=[{dashboard.id}]",
+            headers={"Authorization": f"Bearer {ADMIN_USERNAME}"},
+        )
+
+        assert response.status_code == 200
+        assert response.content_type == "application/zip"
+        assert response.data  # Should have ZIP content
+
+        # Verify it's a valid ZIP
+        with zipfile.ZipFile(io.BytesIO(response.data)) as zf:
+            assert len(zf.namelist()) > 0
+
+    def test_export_dashboard_with_brackets(
+        self,
+        client: FlaskClient,
+        setup_dashboards: tuple[Dashboard, Dashboard, Dashboard],
+    ) -> None:
+        """Test exporting dashboard with brackets in name."""
+        _, dashboard_brackets, _ = setup_dashboards
+
+        response = client.get(
+            f"/api/v1/dashboard/export?q=[{dashboard_brackets.id}]",
+            headers={"Authorization": f"Bearer {ADMIN_USERNAME}"},
+        )
+
+        assert response.status_code == 200
+        assert response.content_type == "application/zip"
+
+        # Check Content-Disposition header
+        content_disposition = response.headers.get("Content-Disposition", "")
+        assert "attachment" in content_disposition
+        assert "filename=" in content_disposition
+
+        # Filename should NOT contain unencoded brackets
+        assert "[" not in content_disposition or "%5B" in content_disposition
+        assert "]" not in content_disposition or "%5D" in content_disposition
+
+        # Verify it's a valid ZIP
+        with zipfile.ZipFile(io.BytesIO(response.data)) as zf:
+            assert len(zf.namelist()) > 0
+
+    def test_export_dashboard_with_special_chars(
+        self,
+        client: FlaskClient,
+        setup_dashboards: tuple[Dashboard, Dashboard, Dashboard],
+    ) -> None:
+        """Test exporting dashboard with special characters."""
+        _, _, dashboard_special = setup_dashboards
+
+        response = client.get(
+            f"/api/v1/dashboard/export?q=[{dashboard_special.id}]",
+            headers={"Authorization": f"Bearer {ADMIN_USERNAME}"},
+        )
+
+        assert response.status_code == 200
+        assert response.content_type == "application/zip"
+
+        # Check that special chars are encoded in header
+        content_disposition = response.headers.get("Content-Disposition", "")
+
+        # / should be encoded as %2F
+        # & should be encoded as %26
+        # ™ should be URL-encoded (could be %E2%84%A2 or other)
+        assert "%" in content_disposition  # Should have URL encoding

Review Comment:
   
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Strengthen special character encoding test</b></div>
   <div id="fix">
   
   The test for special character encoding only checks for the presence of '%' 
in the Content-Disposition header, but does not verify that the specific 
special characters are not present unencoded. This makes the test insufficient 
for ensuring proper URL-encoding. Add assertions to check that '/', '&', and 
'™' are not present unencoded in the header.
   </div>
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ```
    @@ -144,1 +144,4 @@
    + assert "/" not in content_disposition
    + assert "&" not in content_disposition
    + assert "™" not in content_disposition
    + assert "%" in content_disposition  # Should have URL encoding
   ```
   
   </div>
   </details>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run <a 
href=https://github.com/apache/superset/pull/35828#issuecomment-3441867437>#ddf90c</a></i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



##########
tests/integration_tests/dashboard_export_test.py:
##########
@@ -0,0 +1,173 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""
+Tests for dashboard export functionality
+Issue #31158: URL-encoding of special characters in export filenames
+"""
+
+import io
+import zipfile
+from typing import Iterator
+
+import pytest
+from flask.testing import FlaskClient
+
+from superset import db
+from superset.models.dashboard import Dashboard
+from tests.integration_tests.constants import ADMIN_USERNAME
+
+
+class TestDashboardExport:
+    """Test dashboard export endpoint with special characters."""
+
+    @pytest.fixture
+    def setup_dashboards(self) -> Iterator[tuple[Dashboard, Dashboard, 
Dashboard]]:
+        """Create dashboards with special characters in names."""
+        # Baseline dashboard (normal name)
+        dashboard_normal = Dashboard(
+            dashboard_title="Simple Dashboard",
+            slug="simple-dashboard",
+        )
+        db.session.add(dashboard_normal)
+        db.session.flush()
+
+        # Dashboard with brackets
+        dashboard_brackets = Dashboard(
+            dashboard_title="Dashboard [2024] - Q4 Report",
+            slug="dashboard-2024-q4",
+        )
+        db.session.add(dashboard_brackets)
+        db.session.flush()
+
+        # Dashboard with special chars
+        dashboard_special = Dashboard(
+            dashboard_title="Report/Q4 & Analysis™",
+            slug="report-q4-analysis",
+        )
+        db.session.add(dashboard_special)
+        db.session.flush()
+
+        yield dashboard_normal, dashboard_brackets, dashboard_special
+
+        db.session.delete(dashboard_normal)
+        db.session.delete(dashboard_brackets)
+        db.session.delete(dashboard_special)
+        db.session.commit()
+
+    def test_export_dashboard_with_normal_name(
+        self,
+        client: FlaskClient,
+        setup_dashboards: tuple[Dashboard, Dashboard, Dashboard],
+    ) -> None:
+        """Test exporting dashboard with normal name (baseline)."""
+        dashboard, _, _ = setup_dashboards
+
+        response = client.get(
+            f"/api/v1/dashboard/export?q=[{dashboard.id}]",
+            headers={"Authorization": f"Bearer {ADMIN_USERNAME}"},
+        )
+
+        assert response.status_code == 200
+        assert response.content_type == "application/zip"
+        assert response.data  # Should have ZIP content
+
+        # Verify it's a valid ZIP
+        with zipfile.ZipFile(io.BytesIO(response.data)) as zf:
+            assert len(zf.namelist()) > 0
+
+    def test_export_dashboard_with_brackets(
+        self,
+        client: FlaskClient,
+        setup_dashboards: tuple[Dashboard, Dashboard, Dashboard],
+    ) -> None:
+        """Test exporting dashboard with brackets in name."""
+        _, dashboard_brackets, _ = setup_dashboards
+
+        response = client.get(
+            f"/api/v1/dashboard/export?q=[{dashboard_brackets.id}]",
+            headers={"Authorization": f"Bearer {ADMIN_USERNAME}"},
+        )
+
+        assert response.status_code == 200
+        assert response.content_type == "application/zip"
+
+        # Check Content-Disposition header
+        content_disposition = response.headers.get("Content-Disposition", "")
+        assert "attachment" in content_disposition
+        assert "filename=" in content_disposition
+
+        # Filename should NOT contain unencoded brackets
+        assert "[" not in content_disposition or "%5B" in content_disposition
+        assert "]" not in content_disposition or "%5D" in content_disposition

Review Comment:
   
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Fix bracket encoding test assertions</b></div>
   <div id="fix">
   
   The assertion logic in the test for bracket encoding allows unencoded '[' 
and ']' characters in the Content-Disposition header if encoded versions are 
also present, which is incorrect logic for verifying URL-encoding. This could 
potentially allow tests to pass even in edge cases where encoding is malformed. 
Change the assertions to strictly ensure unencoded brackets are absent from the 
header.
   </div>
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ```suggestion
    assert "[" not in content_disposition
    assert "]" not in content_disposition
   ```
   
   </div>
   </details>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run <a 
href=https://github.com/apache/superset/pull/35828#issuecomment-3441867437>#ddf90c</a></i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to