ipx icon indicating copy to clipboard operation
ipx copied to clipboard

Cannot request `svg` output format for `svg` source files

Open sgarner opened this issue 8 months ago • 0 comments

Environment

ipx v3.0.3

Reproduction

n/a

Describe the bug

Requesting an SVG source file without specifying an output format is allowed — it returns the SVG file unmodified (or optimised, if SVGO is enabled).

But requesting an SVG source file and explicitly specifying svg as the output format produces a JPEG output file.

This is because other file types cannot be converted to SVG, so svg is not listed in SUPPORTED_FORMATS and unsupported formats are transformed to jpeg.

The logic ought to be amended so that SVG -> SVG is acceptable.

Additional context

The relevant logic is here:

https://github.com/unjs/ipx/blob/af698d08e6c96e3e551d03a07c045234980b54ff/src/ipx.ts#L224-L252

Logs


sgarner avatar Apr 08 '25 00:04 sgarner