jamf / mut

MIT License
141 stars 10 forks source link

MUT v5 crashing when updating usernames with whitespace #34

Closed ahousseini closed 5 years ago

ahousseini commented 5 years ago

Tried to update usernames with whitespace and MUT.app crashed. The MUT.app v4 can handle usernames with whitespace.

mike-levenick commented 5 years ago

@ahousseini do you mind providing a bit more information about what you're trying to do, and what configuration you have when things crash?

The following line is the one that should allow your URL to have spaces in it:

encodedURL = NSURL(string: "\(cleanURL)".addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!)! as URL

I am discovering that I'm double-encoding spaces, so they get converted from " " to "%20", but then the % gets encoded to "%25", so we get "%2520". I'll work on that. That said, it shouldn't be crashing--and it isn't for me.

mike-levenick commented 5 years ago

@ahousseini I resolved the double-encode issue in 5.0.4b1, you can download it here to test: https://github.com/mike-levenick/mut/releases/tag/v5.0.4b1

If that does not solve your issue, please provide the information requested above, and I'll try to recreate and get this fixed for you ASAP.

ahousseini commented 5 years ago

@mike-levenick Still the same. I attached a screenshot. At the serial numbers you can see that there is something wrong reading the CSV. When I delete the username column the CSV is working fine. When I copy the exact same username column and using it in MUT v4 everything works. I used your beta 5.0.4b1 and the 5.0.4 release.

Screenshot 2019-08-08 at 16 10 50
mike-levenick commented 5 years ago

@ahousseini it looks like it's seeing a line break in that column for some reason.

Do you have non-english characters in any of your usernames? I had a different user report similar behavior when they had an ñ in their department (Español). It ended up being a goofy issue with how Excel was saving their spreadsheet. If you cat the file out in terminal, what does it return?

The fix for them was to re-open Excel and then re-save the CSV as "CSV UTF-8" which fixed the issue:

image

mike-levenick commented 5 years ago

Curious if the CSV UTF-8 resolved the issue for you. Let me know either way!

ahousseini commented 5 years ago

It works now, when saving the CSV as UTF-8. Thank you!

keithemyers commented 4 years ago

@ahousseini it looks like it's seeing a line break in that column for some reason.

Do you have non-english characters in any of your usernames? I had a different user report similar behavior when they had an ñ in their department (Español). It ended up being a goofy issue with how Excel was saving their spreadsheet. If you cat the file out in terminal, what does it return?

The fix for them was to re-open Excel and then re-save the CSV as "CSV UTF-8" which fixed the issue:

image

That worked, thanks!!