golang-ical icon indicating copy to clipboard operation
golang-ical copied to clipboard

Line folding can can break in the middle of a UNICODE character

Open fawkesley opened this issue 6 years ago • 8 comments

Hello again!

I was struggling with a mysterious issue where a character in my calendar was getting mangled.

After quite a lot of research I pinned it down to the way serialize counts line length. The implementation allows it to break a line in the middle of a character.

For example, requires 3 bytes to encode. If it occurs on a line after 74 bytes, the folding routine breaks in the middle of it.

I've made a fix on my fork with some tests to pin down the behaviour:

https://github.com/paulfurley/fork-golang-ical/commit/67e08db67ae7eaa1fa6ea60e8c0a2ad4fec3f4ef

Happy to raise a pull request (in a rush atm), but just wanted to show you what I found for now.

fawkesley avatar Mar 29 '19 18:03 fawkesley

Hi Paul,

Thanks again! I would have gotten away with it too if it wasn't for the meddling rest-of-the-world. Okay. I have read the RFC and glanced at your code. I'm happy with your approach. Just a couple things I added comments on.. Please submit the PR when ready. :)

arran4 avatar Mar 29 '19 23:03 arran4

Haha yes, these pesky users! Thanks again for making it, it's been a really helpful start. You might like to know we're using it to power the iCal feed for the Internet freedom festival

I've found another issue with the new folding approach (it should escape newlines I think). Once I'm more confident it's working correctly for different cases I'll open a PR :+1:

fawkesley avatar Mar 31 '19 12:03 fawkesley

Thanks..

What was the issue you found?

arran4 avatar Apr 19 '19 00:04 arran4

@fawkesley bump.

arran4 avatar Sep 13 '20 05:09 arran4

@fawkesley I will close this on or after the 15th of February if I haven't heard from you.

arran4 avatar Jan 15 '22 06:01 arran4

No worries! If I recall correctly, I implemented the necessary changes on my own fork to get things working. It wasn’t a clean patch as I had to fix the tests which were broken at the time.

fawkesley avatar Jan 18 '22 08:01 fawkesley

Ah.. Did you want to fix it up, then create a draft PR and link me so I can have a look at the diff?

arran4 avatar Jan 23 '22 05:01 arran4