You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "AmoghAtreya (via GitHub)" <gi...@apache.org> on 2026/07/28 16:42:39 UTC
[PR] fix(export): truncate exported filenames to prevent Windows path extraction errors (#42531) [superset]
AmoghAtreya opened a new pull request, #42541:
URL: https://github.com/apache/superset/pull/42541
# fix(export): truncate exported filenames to prevent Windows path extraction errors (#42531)
### SUMMARY
Fixes **#42531** by capping exported filenames generated via `get_filename()` in `superset/utils/file.py` to a maximum component length (`MAX_FILENAME_LENGTH = 128`).
When assets (charts, dashboards, datasets) have long titles (~250+ characters), exported YAML files inside the ZIP archive exceed Windows `MAX_PATH` limits (260 characters) upon extraction. This fix caps individual filename components while leaving ample buffer for extraction destination paths.
Key details:
- Caps individual filename components to `MAX_FILENAME_LENGTH = 128`.
- Replaces negative slicing risks with `max_slug_length = max(max_length - len(id_suffix), 0)` to guarantee safe truncation and clean fallbacks to `str(model_id)`.
- Strips trailing dots, hyphens, and underscores (`.-_`) created during truncation to prevent invalid trailing periods in Windows filenames.
- Expanded unit test coverage in `tests/unit_tests/utils/test_file.py` from 29 to 92 tests, incorporating property-based path assertions, edge cases (extreme lengths, trailing delimiters, non-ASCII input, boundary conditions, and suffix preservation), and mutation-tested invariants.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
*N/A โ backend export filename generation.*
### TESTING INSTRUCTIONS
1. Run unit tests:
```bash
pytest tests/unit_tests/utils/test_file.py
2. Export a chart, dashboard, or dataset with a name over 200 characters long.
3. Extract the generated ZIP archive on a Windows system to verify extraction completes without path length errors.
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [x] Has associated issue: Fixes #42531
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
--
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(export): truncate exported filenames to prevent Windows path extraction errors (#42531) [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas merged PR #42541:
URL: https://github.com/apache/superset/pull/42541
--
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(export): truncate exported filenames to prevent Windows path extraction errors (#42531) [superset]
Posted by "AmoghAtreya (via GitHub)" <gi...@apache.org>.
AmoghAtreya commented on PR #42541:
URL: https://github.com/apache/superset/pull/42541#issuecomment-5161474291
Please let me know if you want me to change anything in the code @rusackas!
--
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(export): truncate exported filenames to prevent Windows path extraction errors (#42531) [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #42541:
URL: https://github.com/apache/superset/pull/42541#issuecomment-5262875395
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
<details>
<summary>
Bito Usage Guide
</summary>
**Commands**
Type the following command in the pull request comment and save the comment.
- `/review` - Manually triggers a full AI review.
- `/pause` - Pauses automatic reviews on this pull request.
- `/resume` - Resumes automatic reviews.
- `/resolve` - Marks all Bito-posted review comments as resolved.
- `/abort` - Cancels all in-progress reviews.
Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</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(export): truncate exported filenames to prevent Windows path extraction errors (#42531) [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #42541:
URL: https://github.com/apache/superset/pull/42541#issuecomment-5243963225
Nice fix for the chart/dashboard export path, thanks @AmoghAtreya!
One thing though: for `skip_id=True` callers like `superset/commands/database/export.py:60`, `get_filename()` drops the id suffix entirely, so two databases (unique, up to 250 chars) that only differ after the truncated 128-char mark now produce the same export filename and silently overwrite each other in the archive. Worth keeping some disambiguator (short hash of the full name, maybe) even when `skip_id` is set?
--
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(export): truncate exported filenames to prevent Windows path extraction errors (#42531) [superset]
Posted by "AmoghAtreya (via GitHub)" <gi...@apache.org>.
AmoghAtreya commented on PR #42541:
URL: https://github.com/apache/superset/pull/42541#issuecomment-5261561505
Thanks for catching that edge-case @rusackas!
I've updated `get_filename()` so that when `skip_id=True` and truncation is triggered, it appends an 8-character content hash derived from the full slug (e.g. `databases/aaaa...aaa_53d2b9f8.yaml`).
This ensures that long database or theme names sharing identical prefixes past the cut point no longer collide or overwrite each other in the archive, while keeping folder names like `datasets/{db_name}/...` stable. Short names remain completely unchanged.
I also added tests covering this case, and all 95 unit tests pass.
--
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(export): truncate exported filenames to prevent Windows path extraction errors (#42531) [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #42541:
URL: https://github.com/apache/superset/pull/42541#issuecomment-5107044375
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
--
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(export): truncate exported filenames to prevent Windows path extraction errors (#42531) [superset]
Posted by "AmoghAtreya (via GitHub)" <gi...@apache.org>.
AmoghAtreya commented on PR #42541:
URL: https://github.com/apache/superset/pull/42541#issuecomment-5445948333
Thanks so much @rusackas for reviewing the PR and merging it! Really appreciate you taking the time to review it!
--
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(export): truncate exported filenames to prevent Windows path extraction errors (#42531) [superset]
Posted by "AmoghAtreya (via GitHub)" <gi...@apache.org>.
AmoghAtreya commented on PR #42541:
URL: https://github.com/apache/superset/pull/42541#issuecomment-5227441482
Hi @rusackas ! Just checking in on the status of the PR. Please let me know when you get a chance to take a look, Iโd appreciate any feedback or a quick review! No rush at allโthanks for your time!
--
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(export): truncate exported filenames to prevent Windows path extraction errors (#42531) [superset]
Posted by "netlify[bot] (via GitHub)" <gi...@apache.org>.
netlify[bot] commented on PR #42541:
URL: https://github.com/apache/superset/pull/42541#issuecomment-5261584501
### <span aria-hidden="true">โ
</span> Deploy Preview for *superset-docs-preview* ready!
| Name | Link |
|:-:|------------------------|
|<span aria-hidden="true">๐จ</span> Latest commit | ba019a759f151ea5f11fe71cc471436b457c9821 |
|<span aria-hidden="true">๐</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/6a7bde2ce5bd0d0008b87ee2 |
|<span aria-hidden="true">๐</span> Deploy Preview | [https://deploy-preview-42541--superset-docs-preview.netlify.app](https://deploy-preview-42541--superset-docs-preview.netlify.app) |
|<span aria-hidden="true">๐ฑ</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br /><br /><br />_Use your smartphone camera to open QR code link._</details> |
|<span aria-hidden="true">๐ค</span> Make changes | [Run an agent on this branch](https://app.netlify.com/projects/superset-docs-preview/agent-runs#DcpBCoAgEEDRu8w6aQgq6QYdQ50phXLEhIzo7rn6f_FeSFnOVGAB6MBmE51vv4Xac02Si9rCwdGcrFr24tUdIsl9NU2cDnlWan4ysyUeHI-WkBBRWz0zD_D9) |
---
<!-- [superset-docs-preview Preview](https://deploy-preview-42541--superset-docs-preview.netlify.app) -->
_To edit notification comments on pull requests, go to your [Netlify project configuration](https://app.netlify.com/projects/superset-docs-preview/configuration/notifications#deploy-notifications)._
--
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(export): truncate exported filenames to prevent Windows path extraction errors (#42531) [superset]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #42541:
URL: https://github.com/apache/superset/pull/42541#issuecomment-5107407325
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/42541?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 `75.00000%` with `2 lines` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 64.44%. Comparing base ([`236c9a5`](https://app.codecov.io/gh/apache/superset/commit/236c9a52fdac5f884e38490dbd2b2e3f6a7046cc?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`95ab789`](https://app.codecov.io/gh/apache/superset/commit/95ab7890d047e6291b863a07b62e7928bc3d4ca3?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 4 commits behind head on master.
| [Files with missing lines](https://app.codecov.io/gh/apache/superset/pull/42541?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/utils/file.py](https://app.codecov.io/gh/apache/superset/pull/42541?src=pr&el=tree&filepath=superset%2Futils%2Ffile.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvdXRpbHMvZmlsZS5weQ==) | 75.00% | [1 Missing and 1 partial :warning: ](https://app.codecov.io/gh/apache/superset/pull/42541?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 #42541 +/- ##
==========================================
- Coverage 65.26% 64.44% -0.83%
==========================================
Files 2795 2795
Lines 157918 157970 +52
Branches 36094 36104 +10
==========================================
- Hits 103070 101797 -1273
- Misses 52853 54184 +1331
+ Partials 1995 1989 -6
```
| [Flag](https://app.codecov.io/gh/apache/superset/pull/42541/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/42541/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `38.27% <37.50%> (-0.03%)` | :arrow_down: |
| [mysql](https://app.codecov.io/gh/apache/superset/pull/42541/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/42541/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [presto](https://app.codecov.io/gh/apache/superset/pull/42541/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `40.18% <37.50%> (-0.03%)` | :arrow_down: |
| [python](https://app.codecov.io/gh/apache/superset/pull/42541/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `57.36% <75.00%> (-1.66%)` | :arrow_down: |
| [sqlite](https://app.codecov.io/gh/apache/superset/pull/42541/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `57.22% <75.00%> (-0.03%)` | :arrow_down: |
| [unit](https://app.codecov.io/gh/apache/superset/pull/42541/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/42541?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