Comfy-Org / Comfy-Org/ComfyUI_frontend

Copy-pasted EXIF parsing in pnginfo.ts and avif.ts

Open
#11,049 0 comments 0 reactions 0 assignees View on GitHub
audit:refactor code-audit
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

## Recommendation

### ♻️ REFACTOR: Extract shared EXIF parser

Nearly identical EXIF parsing code (~60 lines each) is duplicated across two files.

## What Was Found

- `src/scripts/pnginfo.ts:22-80` — `parseExifData` + `parseIFD`
- `src/scripts/metadata/avif.ts:322-380` — Nearly identical implementation, but with `@ts-expect-error` comments the PNG version doesn't have

## Context

Extract shared `parseExifData` into `src/scripts/metadata/exifParser.ts`. This eliminates a bug-divergence risk where a fix in one copy isn't applied to the other.

**Estimated effort:** ~1 hour

---

**Category:** Refactoring Opportunity | **Confidence:** HIGH | **Tools:** Semantic analysis
_Filed by audit-code skill_

Part of #11022

┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-11049-Copy-pasted-EXIF-parsing-in-pnginfo-ts-and-avif-ts-33e6d73d365081359ddaede74abd7b35) by [Unito](https://www.unito.io)

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.