betodealmeida opened a new pull request #14851:
URL: https://github.com/apache/superset/pull/14851
### SUMMARY
<!--- Describe the change below, including rationale and design decisions -->
The current import API needs to raise an error if the user tries to import
and invalid file.
Since we check which files are valid, I added a simple test to all import
APIs:
```python
if not contents:
raise NoValidFilesFoundError()
```
Which returns an error message with a 400 HTTP status code.
I also took the time to SIP-41-fy the endpoints, removing the `@safe`
decorator so exceptions can bubble up to the error handlers. Since the
exceptions that the command can raise all have the correct HTTP status codes,
this will preserve the existing behavior.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
<!--- Skip this if not applicable -->
N/A
### TESTING INSTRUCTIONS
<!--- Required! What steps can be taken to manually verify the changes? -->
Tested manually with an invalid import.
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [ ] Has associated issue:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in
[SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]