ghost-storage-adapter-s3-bartt
Advanced tools
Comparing version 0.1.8-development to 0.1.9-development
15
index.js
@@ -40,2 +40,5 @@ 'use strict'; | ||
}; | ||
var stripQueryParameters = function stripQueryParameters(s) { | ||
return s.indexOf('?') > 0 ? s.substring(0, s.indexOf('?')) : s; | ||
}; | ||
@@ -200,3 +203,3 @@ class Store extends _ghostStorageBase2.default { | ||
Bucket: _this5.bucket, | ||
Key: stripLeadingSlash(stripEndingSlash(_this5.pathPrefix) + req.path) | ||
Key: stripLeadingSlash((0, _path.join)(stripEndingSlash(_this5.pathPrefix), stripQueryParameters(req.path))) | ||
}).on('httpHeaders', function (statusCode, headers, response) { | ||
@@ -217,11 +220,5 @@ return res.set(headers); | ||
return new Promise(function (resolve, reject) { | ||
// remove trailing slashes | ||
var path = (options.path || '').replace(/\/$|\\$/, ''); | ||
var path = stripLeadingSlash(stripEndingSlash(stripQueryParameters(options.path))); | ||
path = (0, _path.join)(stripEndingSlash(_this6.pathPrefix), path); | ||
// check if path is stored in s3 handled by us | ||
if (!path.startsWith(_this6.host)) { | ||
reject(new Error(`${path} is not stored in s3`)); | ||
} | ||
path = path.substring(_this6.host.length); | ||
_this6.s3().getObject({ | ||
@@ -228,0 +225,0 @@ Bucket: _this6.bucket, |
@@ -77,3 +77,3 @@ { | ||
}, | ||
"version": "0.1.8-development" | ||
"version": "0.1.9-development" | ||
} |
@@ -11,2 +11,3 @@ import AWS from 'aws-sdk' | ||
const stripEndingSlash = s => s.indexOf('/') === (s.length - 1) ? s.substring(0, s.length - 1) : s | ||
const stripQueryParameters = s => s.indexOf('?') > 0 ? s.substring(0, s.indexOf('?')) : s | ||
@@ -158,3 +159,3 @@ class Store extends BaseStore { | ||
Bucket: this.bucket, | ||
Key: stripLeadingSlash(stripEndingSlash(this.pathPrefix) + req.path) | ||
Key: stripLeadingSlash(join(stripEndingSlash(this.pathPrefix), stripQueryParameters(req.path))) | ||
}) | ||
@@ -174,11 +175,5 @@ .on('httpHeaders', (statusCode, headers, response) => res.set(headers)) | ||
return new Promise((resolve, reject) => { | ||
// remove trailing slashes | ||
let path = (options.path || '').replace(/\/$|\\$/, '') | ||
let path = stripLeadingSlash(stripEndingSlash(stripQueryParameters(options.path))) | ||
path = join(stripEndingSlash(this.pathPrefix), path) | ||
// check if path is stored in s3 handled by us | ||
if (!path.startsWith(this.host)) { | ||
reject(new Error(`${path} is not stored in s3`)) | ||
} | ||
path = path.substring(this.host.length) | ||
this.s3() | ||
@@ -185,0 +180,0 @@ .getObject({ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29440
355