Add support for special characters in filenames #5

Merged
rogs merged 3 commits from fix-special-characters-issue-on-windows into master 2025-03-19 15:56:37 -03:00
rogs commented 2025-03-19 15:55:20 -03:00 (Migrated from gitlab.com)

Description

This PR improves the robustness of subscleaner when handling files with special characters and enhances error handling. The key changes are:

Fixes #2

  • Switched to using pathlib.Path for file operations to improve cross-platform compatibility
  • Added more robust error handling throughout the codebase
  • Fixed issue with encoding detection by providing fallback to utf-8
  • Improved algorithm for removing ad lines by collecting indices first, then removing them in reverse order
  • Added better file existence checks and validation
  • Fixed a potential issue with file encodings by trying utf-8 as fallback
  • Bumped version from 1.1.5 to 1.2.0 for these enhancements

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)

How Has This Been Tested?

  • Added comprehensive tests for special character handling in filenames
  • Added tests for encoding detection with different file types
  • Added tests for error handling scenarios
  • Added tests for non-existent files
  • Added tests for various special characters including international characters
  • Verified the enhanced ad removal algorithm works correctly
  • Tested the fallback encoding mechanism

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have added tests that prove my fix is effective or my feature works
  • New and existing tests pass with my changes
## Description This PR improves the robustness of subscleaner when handling files with special characters and enhances error handling. The key changes are: Fixes #2 - Switched to using `pathlib.Path` for file operations to improve cross-platform compatibility - Added more robust error handling throughout the codebase - Fixed issue with encoding detection by providing fallback to utf-8 - Improved algorithm for removing ad lines by collecting indices first, then removing them in reverse order - Added better file existence checks and validation - Fixed a potential issue with file encodings by trying utf-8 as fallback - Bumped version from 1.1.5 to 1.2.0 for these enhancements ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Documentation update - [x] Refactoring (no functional changes) ## How Has This Been Tested? - Added comprehensive tests for special character handling in filenames - Added tests for encoding detection with different file types - Added tests for error handling scenarios - Added tests for non-existent files - Added tests for various special characters including international characters - Verified the enhanced ad removal algorithm works correctly - Tested the fallback encoding mechanism ## Checklist - [x] My code follows the project's style guidelines - [x] I have performed a self-review of my code - [x] I have added tests that prove my fix is effective or my feature works - [x] New and existing tests pass with my changes
rogs commented 2025-03-19 15:55:40 -03:00 (Migrated from gitlab.com)

changed the description

changed the description
rogs commented 2025-03-19 15:55:41 -03:00 (Migrated from gitlab.com)

assigned to @rogs

assigned to @rogs
rogs commented 2025-03-19 15:56:37 -03:00 (Migrated from gitlab.com)

mentioned in commit cf619272d3

mentioned in commit cf619272d3d3f645c0ee6daf44d7d6c7b638c6e0
rogs (Migrated from gitlab.com) merged commit cf619272d3 into master 2025-03-19 15:56:37 -03:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: rogs/subscleaner#5
No description provided.