lib/services/s3.js
function removeVirtualHostedBucketFromPath(req) {
    var httpRequest = req.httpRequest;
    var bucket = httpRequest.virtualHostedBucket;
    if (bucket && httpRequest.path) {
      if (req.params && req.params.Key) {
        var encodedS3Key = '/' + AWS.util.uriEscapePath(req.params.Key);
        if (httpRequest.path.indexOf(encodedS3Key) === 0 && (httpRequest.path.length === encodedS3Key.length || httpRequest.path[encodedS3Key.length] === '?')) {
          //path only contains key or path contains only key and querystring
          return;
        }
      }
      httpRequest.path = httpRequest.path.replace(new RegExp('/' + bucket), '');
      if (httpRequest.path[0] !== '/') {
        httpRequest.path = '/' + httpRequest.path;
      }
    }
  }
function removeVirtualHostedBucketFromPath(req) {
    var httpRequest = req.httpRequest;
    var bucket = httpRequest.virtualHostedBucket;
    if (bucket && httpRequest.path) {
      if (req.params && req.params.Key) {
        var encodedS3Key = '/' + AWS.util.uriEscapePath(req.params.Key);
        if (httpRequest.path.indexOf(encodedS3Key) === 0 && (httpRequest.path.length === encodedS3Key.length || httpRequest.path[encodedS3Key.length] === '?')) {
          //path only contains key or path contains only key and querystring
          return;
        }
      }
      httpRequest.path = httpRequest.path.replace(new RegExp('/' + bucket), '');
      if (httpRequest.path[0] !== '/') {
        httpRequest.path = '/' + httpRequest.path;
      }
    }
  }
function removeVirtualHostedBucketFromPath ( req ) { var httpRequest = req . httpRequest ; var bucket = httpRequest . virtualHostedBucket ; if ( bucket && httpRequest . path ) { if ( req . params && req . params . Key ) { var encodedS3Key = '/' + AWS . util . uriEscapePath ( req . params . Key ) ; if ( httpRequest . path . indexOf ( encodedS3Key ) === 0 && ( httpRequest . path . length === encodedS3Key . length || httpRequest . path [ encodedS3Key . length ] === '?' ) ) { //path only contains key or path contains only key and querystring return ; } } httpRequest . path = httpRequest . path . replace ( new RegExp ( '/' + bucket ) , '' ) ; if ( httpRequest . path [ 0 ] !== '/' ) { httpRequest . path = '/' + httpRequest . path ; } } }
Takes the bucket name out of the path if bucket is virtual-hosted

@api private
Takes the bucket name out of the path if bucket is virtual - hosted