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

fix: proto UnmarshalValue on handling string padding #436

Merged
merged 1 commit into from
Sep 16, 2024

Conversation

muktihari
Copy link
Owner

@muktihari muktihari commented Sep 16, 2024

Strings may contains padding bytes. Previously, I thought that the padding only consist of zero bytes, but it turned out the padding bytes can be vary for example workout_step's notes (array: false):
Screenshot from 2024-09-16 13-00-25

Since string in utf8 is terminated by zero, we cut the value up to zero. Now we will omit invalid utf8 character as well, since it does not comply with FIT's string spec.

It was first discovered when handling files from this thread:
https://forums.garmin.com/developer/fit-sdk/f/discussion/383991/my-fit-file-that-i-combined-won-t-upload-to-garmin-connect#pifragment-1304=1

@muktihari muktihari added the bug Something isn't working label Sep 16, 2024
@muktihari muktihari added this to the v0.23.0 milestone Sep 16, 2024
@muktihari muktihari self-assigned this Sep 16, 2024
@muktihari muktihari changed the title fix: proto UnmarshalValue on handling string fix: proto UnmarshalValue on handling string padding Sep 16, 2024
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (e2c16ec) to head (6ba6b98).

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #436   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           42        42           
  Lines         3658      3659    +1     
=========================================
+ Hits          3658      3659    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@muktihari muktihari merged commit 1c69559 into master Sep 16, 2024
5 checks passed
@muktihari muktihari deleted the fix/proto-value-unmarshal-string branch September 16, 2024 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants