Skip to content

Commit

Permalink
Merge pull request #15 from apfister/nullMetadataFix
Browse files Browse the repository at this point in the history
check for null metadata
  • Loading branch information
rgwozdz authored Apr 2, 2019
2 parents bffa182 + fb1f936 commit c561e82
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## Unreleased
### Fixed
* added check for null `metadata` in cache delete

## [1.0.2] - 2019-04-02
### Fixed
* type checking and handling of `callback` and `options` parameters
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ Cache.prototype.delete = function (key, callback) {
if (e) return callback(new Error('Resource not found'))
this.get(METADATA, key, (e, metadata) => {
if (e) return callback(e)
metadata = metadata || {}
metadata.status = 'deleted'
metadata.updated = Date.now()
this.catalog.update(key, metadata, callback)
Expand Down

0 comments on commit c561e82

Please sign in to comment.