Skip to content

Fix readBytes for non-GitHub providers#6243

Merged
pditommaso merged 5 commits intomasterfrom
read_bytes_for_non_text_files
Jul 5, 2025
Merged

Fix readBytes for non-GitHub providers#6243
pditommaso merged 5 commits intomasterfrom
read_bytes_for_non_text_files

Conversation

@swingingsimian
Copy link
Collaborator

@swingingsimian swingingsimian commented Jul 2, 2025

This pull request refactors the RepositoryProvider class and its subclasses to improve handling of binary content and updates related tests to ensure compatibility. The key changes include introducing a new method for binary content retrieval, modifying existing methods to use this new implementation, and adding or updating test cases to validate the changes.

Core Refactoring and Enhancements:

  • Binary Content Handling: Added a new invokeBytes method in RepositoryProvider to handle API responses as byte arrays. Updated the invoke method to use invokeBytes internally for text-based responses.
  • HTTP Response Handling: Updated the checkResponse method to accept generic HTTP response types (HttpResponse<?>) to support both text and binary responses.
  • Deprecation and New HTTP Method: Deprecated the httpSend method and introduced a new httpSend0 method for sending HTTP requests and retrieving binary responses. [1] [2]

Subclass Updates:

  • Refactored readBytes Methods: Updated the readBytes method in subclasses (BitbucketRepositoryProvider, BitbucketServerRepositoryProvider, GiteaRepositoryProvider, GithubRepositoryProvider, and GitlabRepositoryProvider) to use the new invokeBytes method for binary content retrieval. [1] [2] [3] [4] [5]

Test Updates:

  • New Binary Content Tests: Added tests to validate binary content retrieval for BitbucketRepositoryProvider, GiteaRepositoryProvider, and GithubRepositoryProvider. [1] [2] [3]
  • Test Adjustments: Updated or cleaned up existing tests to reflect changes in repository URLs and ensure compatibility with the new implementation. [1] [2] [3]

These changes enhance the flexibility and robustness of the RepositoryProvider class and its subclasses by standardizing binary content handling and improving test coverage.

…and failing GiteaRepositoryProviderTest for image readBytes
@netlify
Copy link

netlify bot commented Jul 2, 2025

Deploy Preview for nextflow-docs-staging canceled.

Name Link
🔨 Latest commit 1fad5fe
🔍 Latest deploy log https://app.netlify.com/projects/nextflow-docs-staging/deploys/686947f8bba083000824a386

@pditommaso
Copy link
Member

Note that the test for GitHub is passing. You may want to have a deeper look why the Gitea is failing

@bentsherman
Copy link
Member

In the linked issue he also reported Bitbucket is failing, other providers haven't been tested

Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
@pditommaso pditommaso marked this pull request as ready for review July 4, 2025 10:21
@pditommaso
Copy link
Member

Think the problem is related to Gitea returning a raw binary response

Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
@pditommaso pditommaso changed the title readBytes for non-text files fail for non-GitHub providers. Fix readBytes for non-GitHub providers Jul 5, 2025
@pditommaso pditommaso merged commit fa79c12 into master Jul 5, 2025
21 of 22 checks passed
@pditommaso pditommaso deleted the read_bytes_for_non_text_files branch July 5, 2025 16:28
pditommaso added a commit that referenced this pull request Jul 6, 2025
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Co-authored-by: Nathan Johnson <nathanjohnson@Nathans-MacBook-Pro.fritz.box>
Co-authored-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
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.

readBytes does not support non-text files for non-Github providers

3 participants