Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions .github/workflows/backend-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: CI
on:
push:
pull_request:
workflow_dispatch:

permissions:
contents: read
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/security-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Security Scan
on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: '0 3 * * 1'

Expand Down
2 changes: 1 addition & 1 deletion backend/internal/service/update_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ func (s *UpdateService) fetchLatestSourceVersion(ctx context.Context) (*UpdateIn
}
latestVersion := strings.TrimSpace(string(raw))
if canonicalVersion(latestVersion) == "" {
return nil, fmt.Errorf("Fork version file contains invalid semantic version %q", latestVersion)
return nil, fmt.Errorf("fork version file contains invalid semantic version %q", latestVersion)
}

return &UpdateInfo{
Expand Down
10 changes: 10 additions & 0 deletions backend/internal/service/update_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,16 @@ func TestUpdateServiceSourceBuildTracksForkVersionFile(t *testing.T) {
require.Empty(t, client.latestRepo, "源码构建不能查询官方或 Fork 的二进制 Release")
}

func TestUpdateServiceSourceBuildRejectsInvalidForkVersion(t *testing.T) {
client := &updateServiceGitHubClientStub{repositoryFile: []byte("not-semver\n")}
svc := NewUpdateService(&updateServiceCacheStub{}, client, "0.1.176-overdraft.1", "source")

info, err := svc.CheckUpdate(context.Background(), true)

require.NoError(t, err)
require.Equal(t, `fork version file contains invalid semantic version "not-semver"`, info.Warning)
}

func TestUpdateServiceSourceBuildIgnoresLegacyOfficialCache(t *testing.T) {
cache := &updateServiceCacheStub{data: `{"latest":"0.1.176","timestamp":4102444800}`}
client := &updateServiceGitHubClientStub{repositoryFile: []byte("0.1.176-overdraft.1\n")}
Expand Down