eclipse / openvsx

An open-source registry for VS Code extensions
https://open-vsx.org/
Eclipse Public License 2.0
1.23k stars 134 forks source link

Some extensions which don't have 'universal' targetPlatform appear as not found in cli tool #943

Closed KMohZaid closed 2 months ago

KMohZaid commented 3 months ago

hello, i was using cli tool to find extensions that are not on https://open-vsx.org/

I found out that Python debugger is on open-vsx but it says not found, https://open-vsx.org/extension/ms-python/debugpy.

after going through code, i found out that by default it checks for "universal". but python debugger have "darwin-arm64' as targetted platform.

how to reproduce?

  1. try ovsx get --metadata ms-python.debugpy

how can we fx it?

https://open-vsx.org/api/ms-python/debugpy -> works https://open-vsx.org/api/ms-python/debugpy/ -> not found https://open-vsx.org/api/ms-python/debugpy/universal -> not found

amvanbaren commented 3 months ago

https://open-vsx.org/api/ms-python/debugpy -> works

As expected. This API endpoint passes null as the target platform. https://github.com/eclipse/openvsx/blob/91ba91ddbae762d37a38c78756a39716eb487aae/server/src/main/java/org/eclipse/openvsx/RegistryAPI.java#L285

Only if the targetPlatform is valid, it is included as a condition in the query: https://github.com/eclipse/openvsx/blob/91ba91ddbae762d37a38c78756a39716eb487aae/server/src/main/java/org/eclipse/openvsx/repositories/ExtensionVersionJooqRepository.java#L864-L866

null is not a valid target platform value: https://github.com/eclipse/openvsx/blob/91ba91ddbae762d37a38c78756a39716eb487aae/server/src/main/java/org/eclipse/openvsx/util/TargetPlatform.java#L47

https://open-vsx.org/api/ms-python/debugpy/ -> not found

Yes, the extra slash causes a 404.

https://open-vsx.org/api/ms-python/debugpy/universal -> not found

As expected. This extension doesn't target the universal platform.

@KMohZaid where in the code is the bug?

KMohZaid commented 3 months ago

@KMohZaid where in the code is the bug?

Hello, I meant cli tool should have option to not specify target platform. For someone who want to get extensions regardless of its target platform or for people like me who want to find all extensions that are not published on open-vsx and update manually

KMohZaid commented 3 months ago

Yes, the extra slash causes a 404.

Yeah i got it why, it is treating target platform as "" empty string