mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix: convert input buffer to PNG before passing to face landmarks Python sidecar
AVIF (and other Sharp-native formats) were written as raw bytes to a .png temp file, causing PIL to fail with "cannot identify image file". Every other AI module wrapper already converts via sharp().png().toBuffer() before writing; face-landmarks was the only one that skipped this step.
This commit is contained in:
@@ -580,11 +580,13 @@ describe("detectFaceLandmarks", () => {
|
||||
expect(result.landmarks).toBeNull();
|
||||
});
|
||||
|
||||
it("does not use sharp to convert to PNG (writes buffer directly)", async () => {
|
||||
it("converts input buffer to PNG before writing", async () => {
|
||||
await detectFaceLandmarks(FAKE_INPUT);
|
||||
|
||||
// face-landmarks writes inputBuffer directly, no sharp conversion
|
||||
expect(writeFile).toHaveBeenCalledWith(expect.stringContaining("face_landmarks_"), FAKE_INPUT);
|
||||
expect(writeFile).toHaveBeenCalledWith(
|
||||
expect.stringContaining("face_landmarks_"),
|
||||
Buffer.from("mock-png-data"),
|
||||
);
|
||||
});
|
||||
|
||||
it("cleans up temp file in finally block", async () => {
|
||||
|
||||
Reference in New Issue
Block a user