Skip to content

Commit

Permalink
Fix: throw error if ocfl object does not exist when accessing file
Browse files Browse the repository at this point in the history
  • Loading branch information
alvinsw committed Sep 27, 2024
1 parent e986be6 commit 17940a1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 15 deletions.
4 changes: 2 additions & 2 deletions ocfl-fs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ocfl/ocfl-fs",
"version": "0.2.1",
"version": "0.2.2",
"description": "Oxford Common File Layout (OCFL) JS client library for filesystem storage",
"main": "index.js",
"exports": {
Expand Down Expand Up @@ -45,7 +45,7 @@
"@ocfl/ocfl-tests": "*"
},
"dependencies": {
"@ocfl/ocfl": "0.2.0"
"@ocfl/ocfl": "0.2.2"
},
"files": [
"index.js",
Expand Down
1 change: 1 addition & 0 deletions ocfl/lib/object.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class OcflObjectFile {
let contentPath = this.contentPath;
if (!contentPath) {
let inv = await this.#ocflObject.getInventory();
if (!inv) throw new Error(`OCFL Object "${this.#ocflObject.id}" does not exist`);
let version = !this.version || this.version === 'latest' ? inv.head : this.version;
let digest = this.digest || inv.getDigest(this.logicalPath, version);
contentPath = inv.getContentPath(digest);
Expand Down
2 changes: 1 addition & 1 deletion ocfl/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ocfl/ocfl",
"version": "0.2.1",
"version": "0.2.2",
"description": "Oxford Common File Layout (OCFL) JS library",
"main": "index.js",
"exports": {
Expand Down
15 changes: 3 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 17940a1

Please sign in to comment.