strongbox: Npm - Return 404 error if repository not found

Task Description

Npm command for example, npm install @angular/core would return return a 406 error if a wrong endpoint is provided in the .npmrc file i.e. registry=http://localhost:48080/storages/storage-npm/. Correct endpoint would be registry=http://localhost:48080/storages/storage-npm/npmjs, correct endpoint would have the repo i.e. npmjs. However, we would like the error to be 404 - repository not found if repo is not there or a wrong one is provided.

init.author.name=Strongbox user
init.author.email=strongbox@localhost.com
email=strongbox@localhost.com
always-auth=true
registry=http://localhost:48080/storages/storage-npm/npmjs
_auth=

; `_auth` is base64 encoded authentication token
; you can use it instead of `username` and `_password`

Tasks

  • Make sure npm install @angular/core returns 404 - repo not found error when wrong repo is provided int the endpoint.
  • Provide tests that expects 404 for /storages/{storageId} and /storages
  • Provide documentation of how @LayoutRequestMapping works under the hood

Screenshots

image

Help

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Comments: 26 (21 by maintainers)

Most upvoted comments

we need to fix the LayoutRequestCondition.getStorageAndRepositoryCondition currently it expects to have /storages/{storageId}/{repositoryId} and the issue we have here is that URL contains only /storages/{storageId} we should improve the LayoutRequestCondition.getStorageAndRepositoryCondition method to return RepositoryNotFoundRequestCondition even if there was no {repositoryId} in URL and it should also return StorageNotFoundRequestCondition if there was no {storageId}

The problem is that we do not identify layout for storage

@pyashwanthkumar @PuneetBabbar I was working on this, but I am having a hard time making any progress. You can take it if you want.

It is an issue with requests being routed to the wrong controller and I can’t figure out why. NPM download requests with an invalid end point are being routed to the Maven download controller.