Skip to content

always return a Buffer from attachment.get. Fixes issue #373 - #374

Merged
glynnbird merged 1 commit into
mainfrom
grb-attachments-are-buffers
Aug 21, 2026
Merged

glynnbird merged 1 commit into
mainfrom
grb-attachments-are-buffers

Conversation

@glynnbird

Copy link
Copy Markdown
Contributor

Overview

db.attachment.get is supposed to return a Promise that resolves to a Buffer, but for JSON attachments, as reported in issue #373, Nano gets too smart and returns a string - the JSON.parse'd data.

This PR fixes the intention of the library - to return a Buffer for all attachment fetches. There was already a flag in place to indicate that JSON.parsing should be suspended, but it was ignored.

Testing recommendations

Automated test added to fetch a JSON attachment and to ensure it's a Buffer.

GitHub issue number

Fixes issue #373

Checklist

  • Code is written and works correctly;
  • Changes are covered by tests;
  • Documentation reflects the changes;

@glynnbird
glynnbird requested a review from janl August 21, 2026 12:02
@glynnbird
glynnbird merged commit 53dea92 into main Aug 21, 2026
3 checks passed
@glynnbird
glynnbird deleted the grb-attachments-are-buffers branch August 21, 2026 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants