/** * Multipart filename helpers for media-library uploads. * * Sitecore derives a media item's `Extension` field from the extension of the * `file` part in the multipart upload — NOT from the item name (which is * intentionally extensionless, see `UploadMediaInput.itemPath`) and NOT from * any `uploadMedia` GraphQL mutation input. So if the multipart filename has * no extension, the resulting media item's `Extension` field is left empty and * the blob won't serve with the right content type — the image reads as broken * / "won't upload". * * This most often bites `external-url` media sources whose URL path tail * carries no extension (CDN / query-style URLs like `.../photo-abc123`), and * the bare `"media"` fallback. `ensureMediaFileName` guarantees the multipart * filename carries an extension, deriving one from the MIME type when the * source name lacks one. */ /** * Best-effort file extension (no dot) for a MIME type. Falls back to the * subtype (`image/svg+xml` → `svg`, dropping any `+suffix` and `;params`), * then to `png` when nothing usable can be derived. */ export declare const extensionForMime: (mimeType: string) => string; /** * Return a multipart filename guaranteed to carry a file extension so Sitecore * populates the media item's `Extension` field. When `fileName` already has * one it is returned unchanged; otherwise an extension derived from `mimeType` * is appended. */ export declare const ensureMediaFileName: (fileName: string, mimeType: string) => string; /** * Canonical image MIME type for a file extension (dot optional), or `undefined` * when the extension isn't a known image type. */ export declare const mimeForExtension: (ext: string) => string | undefined; /** * Resolve the multipart filename AND MIME type for a media upload so Sitecore * derives a correct `Extension` and `Mime Type` on the created item. * * The filename is guaranteed to carry an extension (`ensureMediaFileName`), and * the MIME type is then taken from that extension's canonical image type — so a * junk `Content-Type` forwarded from an `external-url` CDN (e.g. * `application/octet-stream`) is replaced by the type the extension implies. * Only when the extension isn't a known image type is the caller-supplied * `mimeType` kept (covers non-image media like PDFs). */ export declare const resolveMediaUpload: (fileName: string, mimeType: string) => { fileName: string; mimeType: string; };