diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c1bb7477..bb953aa60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [2.1.10] - 2015-06-02 +### Changed +* adding an object id to the list of fields when its missing for CSV data +* Files from S3 now get a the HEAD request data back when checking if files exist + ## [2.1.9] - 2015-05-21 ### Changed * Sending any stored header/field lists to the featureserver code to support ordered fields coming from CSVs data. @@ -244,6 +249,7 @@ Koop is now just a node module that exposes an express middleware app with hooks - koop-server is no more; all central code is in the koop project - to use Koop you must use it as middleware in an app that boots up an http server +[2.1.10]: https://github.com/Esri/koop/compare/v2.1.9...v2.1.10 [2.1.9]: https://github.com/Esri/koop/compare/v2.1.8...v2.1.9 [2.1.8]: https://github.com/Esri/koop/compare/v2.1.7...v2.1.8 [2.1.7]: https://github.com/Esri/koop/compare/v2.1.6...v2.1.7 diff --git a/lib/FeatureServices.js b/lib/FeatureServices.js index 51005fd14..64864e939 100644 --- a/lib/FeatureServices.js +++ b/lib/FeatureServices.js @@ -40,12 +40,19 @@ module.exports = { type, fieldList; + var keys = Object.keys( props ); + if (list) { fieldList = list; + // if our keys and list are diff length we need to add an OID key + // also make sure no ID or OBJECID is already included + if (keys.length > list.length && (list.indexOf('OBJECTID') === -1 || list.indexOf('id') === -1 )) { + fieldList.push('OBJECTID'); + } } else { fieldList = Object.keys( props ); } - fieldList.forEach(function( key ){ + fieldList.forEach(function( key, i ){ if ( key === 'OBJECTID' && !idField){ idField = key; } diff --git a/lib/Files.js b/lib/Files.js index 31d425b3f..92f65da0a 100644 --- a/lib/Files.js +++ b/lib/Files.js @@ -51,14 +51,16 @@ var Files = function( koop ){ Bucket: [this.s3Bucket, subdir].join('/'), Key: name }; - this.s3.getObjectAcl(params, function(err){ - if (err){ + this.s3.getObjectAcl(params, function (err) { + if (err) { koop.log.info('File does not exist on S3 %s %s', self.s3Bucket, subdir, name); callback( false ); } else { - self.s3.getSignedUrl( 'getObject', params, function ( err, url ) { - koop.log.info('File exists on S3 %s %s', self.s3Bucket, name); - callback( true, url.split('?')[0] ); + self.s3.headObject(params, function (err, info) { + self.s3.getSignedUrl( 'getObject', params, function ( err, url, data ) { + koop.log.info('File exists on S3 %s %s', self.s3Bucket, name); + callback( true, url.split('?')[0], info ); + }); }); } }); diff --git a/package.json b/package.json index e79f7b956..a3aeead5a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "koop", - "version": "2.1.9", + "version": "2.1.10", "description": "A node module/express middleware for converting GeoJSON to Esri Feature Services.", "main": "index.js", "scripts": {