Skip to content

Commit

Permalink
Fix eleventy-img issue with missing options in queueSave callback.
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Nov 16, 2024
1 parent 0811640 commit 6204f16
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/RemoteAssetCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class RemoteAssetCache extends AssetCache {
this.fetchCount = 0;
}

static getRequestId(source, options) {
static getRequestId(source, options = {}) {
if (Sources.isValidComplexSource(source)) {
return this.getCacheKey(source, options);
}
Expand Down
16 changes: 16 additions & 0 deletions test/QueueTest.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
const test = require("ava");
const Cache = require("../");
const queue = Cache.queue;
const RemoteAssetCache = require("../src/RemoteAssetCache");

test("Queue without options", async (t) => {
let example = "https://example.com/";
let req = await queue(example, () => {
let asset = new RemoteAssetCache(example);
return asset.fetch();
});

t.truthy(Buffer.isBuffer(req))

try {
await req.destroy();
} catch (e) {}
});

test("Double Fetch", async (t) => {
let pngUrl = "https://www.zachleat.com/img/avatar-2017-big.png";
let ac1 = Cache(pngUrl);
Expand Down Expand Up @@ -79,3 +94,4 @@ test("Double Fetch 404 errors should only fetch once", async (t) => {
await t.throwsAsync(async () => await ac1);
await t.throwsAsync(async () => await ac2);
});

0 comments on commit 6204f16

Please sign in to comment.