Skip to content

Commit

Permalink
Fix for remote image already in disk cache, still should return buffe…
Browse files Browse the repository at this point in the history
…r in output. Caused issues with on-request image optimization
  • Loading branch information
zachleat committed Jul 30, 2024
1 parent 0f6bc69 commit 29b73ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions img.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,12 @@ class Image {
return JSON.stringify(opts);
}

getFileContents(overridePath) {
if(this.isRemoteUrl) {
getFileContents(overrideLocalFilePath) {
if(!overrideLocalFilePath && this.isRemoteUrl) {
return false;
}

let src = overridePath || this.src;
let src = overrideLocalFilePath || this.src;
if(!this._contents) {
this._contents = {};
}
Expand Down
3 changes: 3 additions & 0 deletions src/on-request-during-serve-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ function eleventyImageOnRequestDuringServePlugin(eleventyConfig, options = {}) {
if(!stat) {
throw new Error("Invalid image format.");
}
if(!stat.buffer) {
throw new Error("Could not find `buffer` property for image.");
}

return {
headers: {
Expand Down

0 comments on commit 29b73ae

Please sign in to comment.