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

fix: handle empty string values in datetime parameters#443

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

Open
spo0nman wants to merge1 commit intogithub:main
base:main
Choose a base branch
Loading
fromspo0nman:fix/list-issues-datetime-validation
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file addedgithub-mcp-server
View file
Open in desktop
Binary file not shown.
7 changes: 5 additions & 2 deletionspkg/github/issues.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -442,8 +442,9 @@ func ListIssues(getClient GetClientFn, t translations.TranslationHelperFunc) (to
if err != nil {
return mcp.NewToolResultError(err.Error()), nil
}
if since != "" {
timestamp, err := parseISOTimestamp(since)
// Enhanced validation: handle empty strings, whitespace, and null values
if since != "" && strings.TrimSpace(since) != "" {
timestamp, err := parseISOTimestamp(strings.TrimSpace(since))
if err != nil {
return mcp.NewToolResultError(fmt.Sprintf("failed to list issues: %s", err.Error())), nil
}
Expand DownExpand Up@@ -912,6 +913,8 @@ type ReplaceActorsForAssignableInput struct {
// Returns the parsed time or an error if parsing fails.
// Example formats supported: "2023-01-15T14:30:00Z", "2023-01-15"
func parseISOTimestamp(timestamp string) (time.Time, error) {
// Trim whitespace and check for empty string
timestamp = strings.TrimSpace(timestamp)
if timestamp == "" {
return time.Time{}, fmt.Errorf("empty timestamp")
}
Expand Down
13 changes: 7 additions & 6 deletionspkg/github/notifications.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,6 +7,7 @@ import (
"io"
"net/http"
"strconv"
"strings"
"time"

"github.com/github/github-mcp-server/pkg/translations"
Expand DownExpand Up@@ -93,16 +94,16 @@ func ListNotifications(getClient GetClientFn, t translations.TranslationHelperFu
}

// Parse time parameters if provided
if since != "" {
sinceTime, err := time.Parse(time.RFC3339, since)
if since != ""&& strings.TrimSpace(since) != ""{
sinceTime, err := time.Parse(time.RFC3339,strings.TrimSpace(since))
if err != nil {
return mcp.NewToolResultError(fmt.Sprintf("invalid since time format, should be RFC3339/ISO8601: %v", err)), nil
}
opts.Since = sinceTime
}

if before != "" {
beforeTime, err := time.Parse(time.RFC3339, before)
if before != ""&& strings.TrimSpace(before) != ""{
beforeTime, err := time.Parse(time.RFC3339,strings.TrimSpace(before))
if err != nil {
return mcp.NewToolResultError(fmt.Sprintf("invalid before time format, should be RFC3339/ISO8601: %v", err)), nil
}
Expand DownExpand Up@@ -242,8 +243,8 @@ func MarkAllNotificationsRead(getClient GetClientFn, t translations.TranslationH
}

var lastReadTime time.Time
if lastReadAt != "" {
lastReadTime, err = time.Parse(time.RFC3339, lastReadAt)
if lastReadAt != ""&& strings.TrimSpace(lastReadAt) != ""{
lastReadTime, err = time.Parse(time.RFC3339,strings.TrimSpace(lastReadAt))
if err != nil {
return mcp.NewToolResultError(fmt.Sprintf("invalid lastReadAt time format, should be RFC3339/ISO8601: %v", err)), nil
}
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp