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

Replace 0 bytes in document instead of raising an exception #32

Merged
merged 1 commit into from Jun 29, 2022

Conversation

agateau-gg
Copy link
Collaborator

@agateau-gg agateau-gg commented Jun 27, 2022

Description

Our API expects documents to be text documents: it rejects documents containing 0 bytes. Sometimes text documents do contain such bytes though, see GitGuardian/ggshield#155 for an example.

Instead of forcing all API users to handle 0 bytes, replace them with the Unicode replacement character ()

@codecov-commenter
Copy link

codecov-commenter commented Jun 27, 2022

Codecov Report

Merging #32 (d4d8097) into master (4208324) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master      #32   +/-   ##
=======================================
  Coverage   99.67%   99.67%           
=======================================
  Files           4        4           
  Lines         304      305    +1     
=======================================
+ Hits          303      304    +1     
  Misses          1        1           
Flag Coverage Δ
unittests 99.67% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pygitguardian/client.py 99.03% <ø> (ø)
pygitguardian/models.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4208324...d4d8097. Read the comment docs.

This factorize handling of 0 bytes instead of leaving it up to all
callers.
@agateau-gg agateau-gg merged commit 451c462 into master Jun 29, 2022
@agateau-gg agateau-gg deleted the agateau/handle-0-bytes branch June 29, 2022 14:03
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.

None yet

3 participants