Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP200 when deleting a non-existing asset #3783

Open
sven-dmlr opened this issue Jan 13, 2025 · 1 comment
Open

HTTP200 when deleting a non-existing asset #3783

sven-dmlr opened this issue Jan 13, 2025 · 1 comment

Comments

@sven-dmlr
Copy link
Member

sven-dmlr commented Jan 13, 2025

Situation

When deleting an asset or a file in an asset that does not exist, the api returns HTTP 200.

> sechub-api asset_delete non-existing-asset
Asset "non-existing-asset" will be deleted including its files. This cannot be undone.
 Are you sure? (y/n) y
HTTP/1.1 200

> sechub-api asset_file_delete test-1 this-file-does-not-exist.zip
...
HTTP/1.1 200

Wanted

HTTP 404 along with an explainig JSON message. E.g.:

{
  "status": 404,
  "error": "Not Found",
  "message": "Asset non-existing-asset does not exist, so cannot be deleted",
  "details": [],
  "timeStamp": "Wed Jan 08 10:16:58 GMT 2025"
}

and

{
  "status": 404,
  "error": "Not Found",
  "message": "File this-file-does-not-exist.zip does not exist in asset test-1, so cannot be deleted",
  "details": [],
  "timeStamp": "Wed Jan 08 10:16:58 GMT 2025"
}
@sven-dmlr
Copy link
Member Author

Possible states with desired return codes:

A) enty exists in DB and in S3
action: delete file in DB and S3
-> HTTP 200

B) entry exists in DB and not in S3
action: delete file in DB
-> HTTP 200

C) entry exists not in DB and not in S3
no action
--> HTTP 404

D) entry exists not in DB but in S3 only (relaistic scenario??)
action: delete from S3
--> HTTP 404 (DB is the leading system)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant