Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Use Raw repo resources#70

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

SamMorrowDrums
Copy link
Collaborator

Small bodies are returned encoded by the API already, but unfortunately the MIME type info is not present, and by leveraging the raw resources, we are able to get the content type from the request headers, and also in theory return larger files than the file content limit.

@CopilotCopilotAI review requested due to automatic review settingsApril 2, 2025 21:21
Copy link
Contributor

@CopilotCopilotAI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the repository resource fetching logic to leverage raw endpoints, allowing retrieval of MIME type information via response headers and handling larger files. Key changes include:

  • Updating test logic in pkg/github/repository_resource_test.go to verify content fetching from raw URLs.
  • Refactoring the resource handler in pkg/github/repository_resource.go to determine MIME types based on file extension and HTTP response headers.
  • Introducing separate code paths for text and binary (blob) content based on the MIME type.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

FileDescription
pkg/github/repository_resource_test.goUpdated tests to simulate raw endpoint responses and MIME type detection.
pkg/github/repository_resource.goModified logic for fetching file content and determining MIME types.

Tip: Copilot code review supports C#, Go, Java, JavaScript, Markdown, Python, Ruby and TypeScript, with more languages coming soon.Learn more

),
requestArgs: map[string]any{
"owner": []string{"owner"},
"repo": []string{"repo"},
"path": []string{"README.md"},
"path": []string{"data.png"},
Copy link
Preview

CopilotAIApr 2, 2025

Choose a reason for hiding this comment

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

In the 'successful text content fetch' test, the request argument 'path' is set to 'data.png' while the mockTextContent has a name of 'README.md' (implying a .md extension). This discrepancy could lead to inconsistent MIME type resolution; please ensure that the file name and path are consistent.

Copilot uses AI. Check for mistakes.

SamMorrowDrumsand others added2 commitsApril 2, 2025 23:25
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@SamMorrowDrumsSamMorrowDrums merged commitede9f22 intorepository_resource_testsApr 2, 2025
12 checks passed
SamMorrowDrums added a commit that referenced this pull requestApr 2, 2025
* refactor to make testing easier* not needed in handler func* small cleanup* create repository_resource_test* remove chatty comments* comment cleanup, function rename and some more tests* fix test for ubuntu runner* remove it for now* make required args explicit instead of panic* more tests and cleanup* chore: use raw repo resources (#70)* use raw repo URIs for resources* fetch repository content from raw urls* ensure no error in test write* Update pkg/github/repository_resource.goCo-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>* use appropriate file name for text file test---------Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>---------Co-authored-by: Sam Morrow <info@sam-morrow.com>Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
manian0430 pushed a commit to ChrisLally/github-mcp-server that referenced this pull requestApr 12, 2025
* refactor to make testing easier* not needed in handler func* small cleanup* create repository_resource_test* remove chatty comments* comment cleanup, function rename and some more tests* fix test for ubuntu runner* remove it for now* make required args explicit instead of panic* more tests and cleanup* chore: use raw repo resources (github#70)* use raw repo URIs for resources* fetch repository content from raw urls* ensure no error in test write* Update pkg/github/repository_resource.goCo-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>* use appropriate file name for text file test---------Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>---------Co-authored-by: Sam Morrow <info@sam-morrow.com>Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

Copilot code reviewCopilotCopilot left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant
@SamMorrowDrums

[8]ページ先頭

©2009-2025 Movatter.jp