Skip to main content
zerotal

Documentation


Documentation / @zerotal/admin / index / mediaUrl

Function: mediaUrl()

mediaUrl(item, disk?): Promise<string | null>

Defined in: admin/src/media.ts:142

A URL the browser can fetch for a catalogued file, or null when the disk has none.

null, not the stored path. Returning the path produced a relative src that the browser resolved against whatever admin page was open — a media library at /admin/shop/media asking for media/photo.jpg fetched /admin/shop/media/media/photo.jpg and got the panel's own 404. A caller that knows there is no URL can render a placeholder; one handed a broken string cannot.

Parameters

item

MediaItem

disk?

string

Returns

Promise<string | null>