Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Sanitize filenames in Ruby SDK #47

Open
davidenko87 opened this issue Oct 16, 2018 · 0 comments
Open

Sanitize filenames in Ruby SDK #47

davidenko87 opened this issue Oct 16, 2018 · 0 comments
Assignees
Labels
api-v2 bug Something isn't working

Comments

@davidenko87
Copy link
Contributor

davidenko87 commented Oct 16, 2018

Describe the bug
We select files on their name, but we should also sanitize the names to prevent odd errors from the Transfer / Board endpoints

WeTransfer backend systems sanitize emojis (and control characters and special fs characters) from a file name. The sdk should do that as well, to bring that behavior closer to the end user, and have less surprises.

Expected behavior
We should sanitize the filenames and remove all characters that are lager then 4 bytes to prevent unforeseen errors with the Transfer endpoint

Possible Solution
filename.each_char.select{|c| c.bytes.count < 4 }.join('')

@davidenko87 davidenko87 added bug Something isn't working api-v2 labels Oct 16, 2018
@arnoFleming arnoFleming changed the title Sanitize Strings for filenames Sanitize filenames in Ruby SDK Oct 19, 2018
@arnoFleming arnoFleming self-assigned this Oct 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api-v2 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants