Commit Graph

96 Commits

Author SHA1 Message Date
Cory Gottschalk 970ecc7901 Updated "getFile" to send a 404 for ENOENT errors
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".
2018-06-14 15:19:53 -07:00
Remi Beges c105f8a9ae Add some debug strings to handler and service 2018-01-30 10:29:59 -05:00
Timo Wolf e1109e39dd add AWS S3 options for server side encryption
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.
2017-10-09 09:51:20 +02:00
Raymond Feng 47d555798c Declare container parameter for swagger spec
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.
2017-08-30 13:45:19 -07:00
Miroslav Bajtoš 7cf4d883ef
Mark HTTP path parameters as required
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).
2017-08-30 15:09:02 +02:00
Raymond Feng 636692a8a5 Update deps 2017-03-09 08:22:03 -08:00
Raymond Feng 2cea6a0c8d Merge branch 'master' of https://github.com/hgouveia/loopback-component-storage into hgouveia-master
# Conflicts:
#	lib/storage-handler.js
#	test/upload-download.test.js
2017-03-01 15:32:11 -08:00
Raymond Feng 0f521a1c2d Merge pull request #186 from jeffora/fix-error-handling
Fix #185: Validation failures crash server
2017-03-01 15:20:33 -08:00
Raymond Feng 4ef64a8d50 Merge branch 'max-fields-size-override' of https://github.com/obernal/loopback-component-storage into obernal-max-fields-size-override
# Conflicts:
#	lib/storage-service.js
2017-03-01 15:19:52 -08:00
Raymond Feng 656fba9d51 Fix eslint 2017-03-01 15:18:26 -08:00
Raymond Feng aab81590ed Merge pull request #182 from ole3021/fix/range-undefined-err
fix scope error
2017-03-01 15:11:28 -08:00
Raymond Feng b6e06dbceb Merge pull request #122 from vergara/fix-user
Added support for external providers as npm modules.
2017-03-01 15:07:28 -08:00
Raymond Feng 4d4e530955 Merge pull request #188 from cfjedimaster/master
look for a nameConflict option and use a uuid if value is makeUnique
2017-03-01 15:04:30 -08:00
Loay c6978261c7 Fix path joining/expanding 2017-02-10 16:26:30 -05:00
Raymond Camden ec959d2c38 fix lint 2017-02-02 09:19:28 -06:00
Raymond Camden 907f83ac3a Support nameConflict and makeUnique options 2017-02-01 13:16:53 -06:00
Jeff Burn 99fdb64d1e Fix #185: Validation failures crash server
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
2016-12-21 09:27:40 +11:00
ole3021 32bf1a90d8 fix scope error 2016-12-07 16:19:11 +08:00
Miroslav Bajtoš 6cb5a294c5 Continue middleware chain after download error
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.
2016-11-10 15:58:39 -05:00
Miroslav Bajtoš 9997041093 Clean up "download()" implementation
Reduce nesting, remove repetition.
2016-11-10 14:20:38 +01:00
Loay f944fa2fd7 Return error when no file is uploaded 2016-11-09 16:01:36 -05:00
Loay 0931e9da83 Upgrade loopback to 3.0.0 2016-10-24 11:36:46 -04:00
Amir Jafarian eabf221d12 Fix `use strict`
* Fix `use strict` for `filesystem/index.js`
2016-10-20 16:31:23 -04:00
Amir Jafarian 4c2751a2a4 Fix linting errors 2016-10-19 11:36:39 -04:00
Amir Jafarian 7900d48126 Auto-update by eslint --fix 2016-10-18 18:06:55 -04:00
Jose De Gouveia efe4e089f6 added file field name into getFilename function 2016-09-07 17:46:43 +02:00
Loic VELUT f9d293e1fa Add provider upload response in final response 2016-08-18 10:56:02 +02:00
Richard Pringle 20d9aaadf2 Continue middleware chain after download. 2016-08-16 16:28:47 -04:00
Richard Pringle d1035d5445 Add globalization to module. 2016-08-05 14:03:10 -04:00
Gary Torres a8fe32d78a Fix for issue #127 2016-06-14 11:20:24 -06:00
Ryan Graham 728a1986df
update/insert copyright notices 2016-05-03 16:18:18 -07:00
Rand McKinney 9f31877872 Update storage-service.js
Clean up download API doc.
2016-04-27 16:05:11 -07:00
Cristobal Vergara 9aba5658a2 Added support for external providers as npm modules. 2016-04-27 08:51:23 -07:00
Rand McKinney 6bf9361451 Update storage-service.js
Doc: add missing parameter to API docs, per #115
2016-03-29 15:02:23 -07:00
Santiago Osorio 8eaf9f54a0 Expose `originalFilename` property
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).
2016-01-06 10:36:36 -06:00
Oscar Bernal 6ed00d2c88 added maxFieldsSize override to formidable limit 2015-12-23 09:15:44 -05:00
Raymond Feng fdb4c0464e Add range support 2015-11-23 17:16:48 -08:00
Rand McKinney 2f8b11cee4 Fix link to docs 2015-09-15 11:05:22 -07:00
Raymond Feng e8c76eef93 Capture writer error 2015-07-31 12:06:07 -07:00
Oleksii Strutsynskyi 3158e3e479 Bugfix: Cannot read property 'forEach' of undefined 2015-06-11 11:28:34 -04:00
Raymond Feng ab1ed48674 Add var 2015-06-08 15:30:43 -07:00
ningsuhen f220141419 Fix for issues - #58, #23 & #67 2015-06-01 13:25:04 +05:30
Raymond Feng 1e4a5c9f2a Merge pull request #55 from leandropio/patch-1
Expose file size on success callback
2015-04-21 12:59:25 -07:00
Yazhong Liu 24f24f12a2 this.options is undefined, should use options 2015-04-12 00:24:23 +08:00
Leandro e035e4fd4e Expose file size on success callback
Just expose the file size through the file object that later will be sent as succes callback attribute (line 160). This way if somebody needs to persist the file metadata in another model now it will exist the whole basic pack: Container, Name, Type and now Size.
2015-03-29 21:06:53 -03:00
Raymond Feng 09cb66d062 Merge pull request #43 from jury89/feature/uploadStream-fix-cb
is not necessary to pass cb to pkgcloud
2015-03-02 08:38:07 -08:00
Benjamin Boudreau 55997f8a9f Adding error handler on upload stream 2015-02-27 14:06:49 -05:00
Benjamin Boudreau 95baaff716 Adding support for ACL, Content-Type, Max File Size and allowd Content-Types 2015-02-10 09:26:14 -05:00
Jury D'Ambros 38e1503c30 removed callback from downloadStream method 2015-02-03 09:36:41 +00:00
Jury D'Ambros b3f0d757c6 is not necessary to pass cb to pkgcloud 2015-02-02 17:04:55 +00:00