You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "eschutho (via GitHub)" <gi...@apache.org> on 2026/10/17 16:34:39 UTC

[PR] fix(import): return 422 instead of 500 for non-UTF-8 members in import bundles [superset]

eschutho opened a new pull request, #45424:
URL: https://github.com/apache/superset/pull/45424

   <!---
   Licensed to the ASF; see PR template.
   -->
   ### SUMMARY
   Importing a ZIP bundle whose `.yaml`/`.yml` member is not valid UTF-8 now returns a 422 instead of an opaque 500.
   
   ### PROBLEM
   `get_contents_from_bundle()` does `bundle.read(name).decode()`. A non-UTF-8 member raises a raw `UnicodeDecodeError` (a `ValueError`) that `open_import_bundle()` does not catch, so it reaches the catch-all `show_unexpected_exception` handler -> 500 plus an ERROR log. Reachable from all import APIs (charts, dashboards, databases, datasets, assets, saved queries, themes) and the CLI.
   
   ### FIX
   Catch `UnicodeDecodeError` in `get_contents_from_bundle` and raise `IncorrectFormatError` (422), the same class `open_import_bundle` already uses. Follow-up to #45380.
   
   ### TESTING INSTRUCTIONS
   Unit tests: `tests/unit_tests/commands/importers/v1/utils_test.py` and `tests/unit_tests/importexport/api_test.py`. Both new tests fail on pre-fix code (`UnicodeDecodeError` / `500 == 422`) and pass after. Manually: upload a bundle with `metadata.yaml` containing `\xff\xfe\x00bad` to `/api/v1/assets/import/` and expect 422.
   
   ### ADDITIONAL INFORMATION
   - [ ] Changes UI
   - [ ] Includes DB Migration
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(import): return 422 instead of 500 for non-UTF-8 members in import bundles [superset]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #45424:
URL: https://github.com/apache/superset/pull/45424#issuecomment-6237060519

   ## [Codecov](https://app.codecov.io/gh/apache/superset/pull/45424?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `77.77778%` with `2 lines` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 65.04%. Comparing base ([`ae71281`](https://app.codecov.io/gh/apache/superset/commit/ae71281c519bf9b7f5fa30ce0360affad5792e8a?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`1f18412`](https://app.codecov.io/gh/apache/superset/commit/1f18412c0a8fc453029ca10098f4499eef62c070?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/superset/pull/45424?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [superset/commands/importers/v1/utils.py](https://app.codecov.io/gh/apache/superset/pull/45424?src=pr&el=tree&filepath=superset%2Fcommands%2Fimporters%2Fv1%2Futils.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvY29tbWFuZHMvaW1wb3J0ZXJzL3YxL3V0aWxzLnB5) | 77.77% | [2 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/45424?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #45424      +/-   ##
   ==========================================
   - Coverage   65.16%   65.04%   -0.13%     
   ==========================================
     Files        3048     3048              
     Lines      199661   199669       +8     
     Branches    46583    46585       +2     
   ==========================================
   - Hits       130116   129880     -236     
   - Misses      66618    66853     +235     
   - Partials     2927     2936       +9     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/superset/pull/45424/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [hive](https://app.codecov.io/gh/apache/superset/pull/45424/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `34.97% <0.00%> (-0.01%)` | :arrow_down: |
   | [mysql](https://app.codecov.io/gh/apache/superset/pull/45424/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [postgres](https://app.codecov.io/gh/apache/superset/pull/45424/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `52.97% <77.77%> (+<0.01%)` | :arrow_up: |
   | [presto](https://app.codecov.io/gh/apache/superset/pull/45424/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `36.73% <0.00%> (-0.01%)` | :arrow_down: |
   | [python](https://app.codecov.io/gh/apache/superset/pull/45424/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `53.05% <77.77%> (-0.21%)` | :arrow_down: |
   | [sqlite](https://app.codecov.io/gh/apache/superset/pull/45424/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/superset/pull/45424?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(import): return 422 instead of 500 for non-UTF-8 members in import bundles [superset]

Posted by "eschutho (via GitHub)" <gi...@apache.org>.
eschutho merged PR #45424:
URL: https://github.com/apache/superset/pull/45424


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(import): return 422 instead of 500 for non-UTF-8 members in import bundles [superset]

Posted by "eschutho (via GitHub)" <gi...@apache.org>.
eschutho closed pull request #45424: fix(import): return 422 instead of 500 for non-UTF-8 members in import bundles
URL: https://github.com/apache/superset/pull/45424


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(import): return 422 instead of 500 for non-UTF-8 members in import bundles [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on PR #45424:
URL: https://github.com/apache/superset/pull/45424#issuecomment-6236908278

   ## CodeAnt PR Risk: Low Risk
   
   - The PR appears safe to merge: invalid UTF-8 in imported configuration files now raises a format error instead of an unhandled decoding exception.
   - Tests cover both the format error and the API’s 422 response.
   
   **Assessed commit:** `1f18412c0a8f`


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org