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

Refactor fix_file_limit to fix_byte_limit #27

Merged
merged 1 commit into from
Mar 9, 2023

Conversation

dwaris
Copy link
Contributor

@dwaris dwaris commented Mar 9, 2023

Why

  • Most filesystems use 255 bytes as the max filename length. The current fix_file_limit function however, will not work on Linux because it's using the length in characters.
  • We should use the byte size for cross-platform compatibility.

What Changed?

Refactor of fix_file_limit to fix_byte_limit.

  • Use UTF-8 for cross-platform compatibility.
  • If name is too long, truncate it!
  • We call the function at album, title and playlist creation. No need to iterate over every folder in relative path, we already checked them at creation.
  • Fixes issue Songs with weird/long names don't save properly #6

Use byte size instead of str length for cross-platform compatibility.
@dwaris dwaris changed the title Refactor fix_file_limit to fix_byte_limit, fixes #6 Refactor fix_file_limit to fix_byte_limit Mar 9, 2023
@Dniel97
Copy link
Collaborator

Dniel97 commented Mar 9, 2023

Nice work! You are correct a byte size limit is way better than the character limit. I didn't bother with it really because I mainly use macOS and Windows so that's not an issue there.

Thank you for the contribution.

@Dniel97 Dniel97 merged commit fd5792a into OrfiTeam:master Mar 9, 2023
@dwaris dwaris deleted the fix/file-limit branch March 9, 2023 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants