Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sanitize exported file names to fix error during export #76

Merged
merged 4 commits into from
Jan 22, 2025

Conversation

Nightriff
Copy link
Collaborator

Fixes #67 where Blender allows object names to contain characters considered to be invalid for a file name by the operating system. Since this add-on uses the object name as the file name, an error occurs during export.

This PR fixes the problem by "sanitizing" (removing) any characters that are not isalnum() or in a set of other allowed characters , ., and _.

Since this could result in an empty file name for objects that only contain invalid characters in their name, the file is also prefixed with exported_ to ensure it has a valid file name.

@Nightriff Nightriff changed the title Quick & dirty sanitization for file names to cover common cases Sanitize exported file names to fix error during export Jan 21, 2025
@Nightriff Nightriff marked this pull request as ready for review January 21, 2025 10:11
@Nightriff Nightriff self-assigned this Jan 21, 2025
@Nightriff Nightriff added the bug Something isn't working label Jan 21, 2025
Base automatically changed from feature/recommended-extensions to main January 22, 2025 02:04
@Nightriff Nightriff dismissed othomson-roblox’s stale review January 22, 2025 02:04

The base branch was changed.

@Nightriff Nightriff merged commit 2eee79c into main Jan 22, 2025
2 checks passed
@Nightriff Nightriff deleted the fix/unsanitized-export-names branch January 22, 2025 02:27
@github-actions github-actions bot locked and limited conversation to collaborators Jan 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sanitize exported file names to avoid file system errors
2 participants