coder / code-marketplace

Open source extension marketplace for VS Code.
GNU Affero General Public License v3.0
227 stars 24 forks source link

Incomplete artifactory uploads cause the marketplace to crash #68

Closed janLo closed 1 month ago

janLo commented 1 month ago

If there is an incomplete upload to Artifactory, meaning, the folder structure down to the version is there, but the actual manifest is missing, I get the following crash:

2024-10-29 11:37:11.497 [erro]  Unable to read extension manifest  error="file does not exist"  id=golang.Go@0.42.1  targetPlatform=""
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x7e184d]

goroutine 494 [running]:
github.com/coder/code-marketplace/storage.NewArtifactoryStorage.func1.1()
        /home/losinski/devel/code-marketplace/storage/artifactory.go:97 +0x2d
golang.org/x/sync/errgroup.(*Group).Go.func1()
        /home/losinski/go/pkg/mod/golang.org/x/sync@v0.7.0/errgroup/errgroup.go:78 +0x64
created by golang.org/x/sync/errgroup.(*Group).Go
        /home/losinski/go/pkg/mod/golang.org/x/sync@v0.7.0/errgroup/errgroup.go:75 +0xa5

I ended up with this using our extension mirror which used the upstream extensionquery endpoint for metadata which gave for the Golang extension golang.Go while the actual manifest that is used by the marketplace for the metadata states golang.go. This meant we put the signature file in golang/Go/0.42.1 instead of golang/go/0.42.1 where the code-marketplace put the manifest.

As I totally understand that there is nothing code-marketplace can do about the incomplete hierarchy (and we've fixed the metadata on our side since), I think it should not crash.

I'll try to come up with a PR to ignore incomplete directories.

code-asher commented 1 month ago

Good catch!