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

Support extraction of a subset of zip contents #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hryx
Copy link
Contributor

@hryx hryx commented Oct 17, 2022

Description

Closes #11

Special handling of music files was moved to another service. Now this change only adds support for extracting a subset of the files in a zip via a new only_files query parameter. The value of only_files should be a URL-encoded JSON array of strings, where each string is the full path/name of a file in the zip.

See commit message for more implementation details.

Original branch history can still be seen at master...hryx:music-scratch-2

@hryx hryx marked this pull request as draft October 17, 2022 05:25
zipserver/archive.go Outdated Show resolved Hide resolved
zipserver/extract_handler.go Outdated Show resolved Hide resolved
@hryx
Copy link
Contributor Author

hryx commented Oct 18, 2022

The change to extractAndUploadOne looks very heavy because I moved the main logic to GameAnalyzer, so I might recommend looking at files side by side for that part if it's hard to understand.

@hryx hryx marked this pull request as ready for review October 18, 2022 23:34
@hryx
Copy link
Contributor Author

hryx commented Oct 19, 2022

I added omitempty to all metadata fields since there will often be empty values wasting space in the response. Not opinionated about it though, so I defer to your preference.

Closes itchio#11

- Add only_files query param to /extract
- Test extraction results with only_files

Other details:

- Add Analyzer interface. Originally this was used to handle game and
  music zips differently, but now only GameAnalyzer remains.
- Rename some args and fields for clarity
- Change some structs, namely removing ResourceSpec, which fragmented
  concerns across domains a bit. Logic which affected outgoing headers was
  consolidated under the GameAnalyzer implementation.
- Add optional Metadata field to API result JSON.
- Tests: Replaced assert.NoError() with require.NoError(). The latter stops
  a test immediatly if the assertion fails, which prevents useless and
  noisy panic traces in test output. No dependencies added, already part
  of the testify module.
- Removed unnecessary struct literal type names when they can be inferred,
  per linter.
- Log non-OK notification responses
@hryx hryx changed the title Music album support Support extraction of a subset of zip contents Nov 29, 2022
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.

Add support for uploading a specified list of files
2 participants