Skip to content

Conversation

@magecnion
Copy link
Collaborator

  • Introduce <string> tags around valid UTF-8 byte sequences in the output.
  • Update documentation to reflect these changes.
  • Modify the bencoded_string_with_repeated_byte function so it works with other lengths different from 1000000.

@codecov
Copy link

codecov bot commented Nov 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.23%. Comparing base (bc0fd09) to head (15e4584).
Report is 5 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop      #13      +/-   ##
===========================================
+ Coverage    99.19%   99.23%   +0.03%     
===========================================
  Files           11       11              
  Lines         2618     2749     +131     
===========================================
+ Hits          2597     2728     +131     
  Misses          21       21              

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

Copy link
Member

@josecelano josecelano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @magecnion, thank you! Looks good. I will merge it when you set it as ready to review.

Comment on lines +317 to +320
assert_eq!(
bencode_to_json_unchecked(b"00:"),
r#""<string></string>""#.to_string()
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @magecnion I have not thought about this case. Empty byte sequences could be mapped to hex of string tags. However, I prefer what you did. Since tags are mandatory and JSON uses UTF-8 I prefer to use the tag <string> for empty byte sequences.

@josecelano josecelano self-assigned this Nov 26, 2024
@magecnion magecnion marked this pull request as ready for review November 27, 2024 07:13
@josecelano
Copy link
Member

ACK 15e4584

@josecelano josecelano merged commit a2eb63c into torrust:develop Nov 27, 2024
10 checks passed
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.

How do you represent bencoded strings that contain a <hex> tag to avoid ambiguity?

2 participants