getFile sends a 500 error response when the requested file cannot be
found, but the status code probably should be 404. This change sets
the status of the error to 404 when the error code is "ENOENT".
Now, the AWS S3 options for server side encryptions are passed to the
upload handler. Thus, the client can specify the AWS options and use
AWS Server Side Encryption.
Without this change, generated Swagger spec for the upload operation
does not have `container` parameter even it's a variable on the path.
As a result, the sepc fails validations.
An optional `container` is added to the remote method. Conditional
check is added to ensure backward compatibility.
Per Swagger spec 2.0, parameters coming from the path must be marked
as required.
Before this change, the Swagger spec produced by loopback-swagger
was not valid because path parameters were optional.
Note that this commit does not fix the problem of the "uploaded"
method which does not have any swagger-supported parameters now,
and therefore the swagger spec will remain invalid (but with less
errors).
Fixes issue where upload and download methods in FileSystemProvider
cause crashes in downstream methods by not returning streams in error
scenarios
- Add streamError, readStreamError, writeStreamError helper function
- Wrap all returns from upload / download methods in streams
- Fix incorrect format string
- Add new unit tests
Stop sending constructing the error response directly inside the
storage component and send the error back to the application to handle
it.
As a result:
- `File.afterRemoteError` hook is trigered now
- App-provided error handling strategy is used to build error
responses, e.g. using the production mode of strong-error-handler
to hide sensitive information.
Filename is replaced when `getFilename` is set in the options, this commit sets a new property called `originalFilename` to keep the original filename (only works when you upload the file, after that you need to save it in a model).