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

Make uploads content seekable #2247

Merged
merged 1 commit into from
Jun 30, 2022
Merged

Make uploads content seekable #2247

merged 1 commit into from
Jun 30, 2022

Conversation

Desuuuu
Copy link
Contributor

@Desuuuu Desuuuu commented Jun 23, 2022

Uploads currently expose their content as an io.Reader, which makes it hard to read their content multiple times.

The content is either backed by an os.File which is seekable or a bytesReader (in-memory buffer) which can be trivially made seekable.

This PR makes bytesReader implement the io.Seeker interface and changes the type of the field File in Upload to io.ReadSeeker to allow consumers to simply call Seek on the upload's content.

The prevRune field has also been removed from bytesReader since it was unused.

I have:

  • Added tests covering the bug / feature (see testing)
  • Updated any relevant documentation (see docs)

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.02%) to 75.085% when pulling 8925842 on Desuuuu:upload-seek into a8f112e on 99designs:master.

@StevenACoffman StevenACoffman merged commit 532d46a into 99designs:master Jun 30, 2022
@Desuuuu Desuuuu deleted the upload-seek branch June 30, 2022 17:01
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.

3 participants