diegomura / diegomura/react-pdf

Image caching causes wrong images to be shown for Buffer source

Open
#1,805 3 comments 5 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
16.8k
Forks
1.3k
Avg merge
5h 6m
Merged PRs (30d)
52

Description

**Describe the bug**
Cache key creation (https://github.com/diegomura/react-pdf/blob/6ea172340b0e89b01a985e91eee257c43b243c54/packages/image/src/resolve.js#L160) is invalid for Buffer sources; a node.js Buffer has neither `.data` nor `.uri`, so cacheKey is always undefined and thus the first cached image will be reused for subsequent pdf renders.

**To Reproduce**
1. Pass a Buffer to ``

**Expected behavior**
A proper cacheKey is generated for buffers so that images are cached properly (or alternatively caching is disabled for buffers)

**Desktop (please complete the following information):**
- React-pdf version: main

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.