Skip to content

Commit

Permalink
Adjust addCorsMapping to cover all /vscode/** endpoints. Add
Browse files Browse the repository at this point in the history
@crossorigin annotation too remaining vscode adapter endpoints.

Signed-off-by: Ber Zoidberg <ber.zoidberg@gmail.com>
  • Loading branch information
dustydecapod committed Aug 23, 2021
1 parent 6674bf4 commit c8c7291
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ private FileResource getFileFromDB(ExtensionVersion extVersion, String assetType
}

@GetMapping("/vscode/item")
@CrossOrigin
public ModelAndView getItemUrl(@RequestParam String itemName, ModelMap model) {
var dotIndex = itemName.indexOf('.');
if (dotIndex < 0) {
Expand All @@ -285,6 +286,7 @@ public ModelAndView getItemUrl(@RequestParam String itemName, ModelMap model) {
}

@GetMapping("/vscode/gallery/publishers/{namespace}/vsextensions/{extension}/{version}/vspackage")
@CrossOrigin
public ModelAndView download(@PathVariable String namespace, @PathVariable String extension,
@PathVariable String version, ModelMap model) {
if (googleStorage.isEnabled()) {
Expand Down Expand Up @@ -412,4 +414,4 @@ private boolean test(int flags, int flag) {
return (flags & flag) != 0;
}

}
}
4 changes: 3 additions & 1 deletion server/src/main/java/org/eclipse/openvsx/web/WebConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ public void addCorsMappings(CorsRegistry registry) {
.allowedOrigins("*");
registry.addMapping("/api/**")
.allowedOrigins("*");
registry.addMapping("/vscode/**")
.allowedOrigins("*");
}
}

Expand All @@ -56,4 +58,4 @@ public void addViewControllers(ViewControllerRegistry registry) {
}
}

}
}

0 comments on commit c8c7291

Please sign in to comment.