Socket
Socket
Sign inDemoInstall

s3-proxy

Package Overview
Dependencies
63
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.1 to 1.2.1

10

lib/s3.js

@@ -60,2 +60,7 @@ var AWS = require('aws-sdk');

// If the key is empty (this occurs if a request comes in for a url ending in '/'), and there is a defaultKey
// option present on options, use the default key
// E.g. if someone wants to route '/' to '/index.html'
if ( s3Key === '' && options.defaultKey ) s3Key = options.defaultKey;
// Chop off the querystring, it causes problems with SDK.

@@ -158,3 +163,6 @@ var queryIndex = s3Key.indexOf('?');

if (req.path.slice(-1) === '/') {
//If a request is made to a url ending in '/', but there isn't a default file name,
// return a list of s3 keys. Otherwise, let the getObject() method handle the request
// E.g. if someone wants to route '/' to '/index.html' they should be able to bypass listKeys()
if (!options.defaultKey && req.path.slice(-1) === '/') {
listKeys(req, res, next);

@@ -161,0 +169,0 @@ } else {

24

package.json
{
"name": "s3-proxy",
"version": "1.1.1",
"description":
"Streaming http proxy Express middleware for fetching objects from S3",
"version": "1.2.1",
"description": "Streaming http proxy Express middleware for fetching objects from S3",
"main": "index.js",
"scripts": {
"test": "mocha --reporter spec --bail --check-leaks test/",
"test-cov":
"istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
"test-travis":
"istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
},

@@ -18,4 +15,13 @@ "repository": {

},
"keywords": ["express", "middleware", "aws", "s3", "proxy"],
"files": ["index.js", "lib"],
"keywords": [
"express",
"middleware",
"aws",
"s3",
"proxy"
],
"files": [
"index.js",
"lib"
],
"author": "David Von Lehman (https://github.com/dvonlehman)",

@@ -22,0 +28,0 @@ "license": "Apache-2.0",

@@ -20,3 +20,4 @@ # s3-proxy

secretAccessKey: 'aws_secret_access_key',
overrideCacheControl: 'max-age=100000'
overrideCacheControl: 'max-age=100000',
defaultKey: 'index.html'
}));

@@ -55,2 +56,7 @@ ~~~

__`defaultKey`__
If a call is made to a url ending in `/`, and this option is present its value is used as the s3 key name. For example, you may wish to allow users to access `/index.html` when calling `/` on a route.
### HTTP Cache Headers

@@ -95,4 +101,7 @@

### Listing objects
It's also possible to return a JSON listing of all the keys by making a request ending with a trailing slash. For the sample above, issuing a request to `/media/images/` will return: `['logo.png', 'background.jpg']`.
It's also possible to return a JSON listing of all the keys by making a request ending with a trailing slash. For the sample above, issuing a request to `/media/images/` will return: `['logo.png', 'background.jpg']`. This is the default behavior when `defaultKey` is false.
### Default Key
If you don't need list objects when making requests ending in a trailing slash, you can instead use a default s3 key by setting the parameter `defaultKey` in options. For example, if `defaultKey` is set to `index.html`, calls to urls like `/media` will return to object `/media/index.html`.
## License

@@ -99,0 +108,0 @@ Licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0).

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc