relinkMisclassifiedVideosOp
relinkMisclassifiedVideosOp(
ctx:MediaOperationsContext,walletAddress:string):Promise<number>
Defined in: src/lib/db/media/operations.ts:352
Recovery migration: relink videos that were mistakenly stored as images.
Earlier builds captured MCP video URLs via the image-extraction fallback and
created StoredMedia records with media_type = "image". Those records hold
the video in encrypted OPFS but never surface in the video player’s fallback
or the Videos library tab.
name/source_url are encrypted at rest, so they can’t be matched with SQL.
Detection works off the plaintext mime_type:
video/*— blob type was correctimage/{mp4,webm,mov}— blob type was empty, stampedimage/<urlext>application/octet-stream— generic; ambiguous in plaintext, so we decrypt the record and confirm a video extension onsourceUrl/namebefore flipping (avoids turning real documents/images into video).
Confirmed rows are flipped to video and their mime repaired to video/<ext>
so they stay classified correctly. Idempotent: once video, rows fall out of
the media_type = "image" candidate set.
Parameters
| Parameter | Type |
|---|---|
|
| |
|
|
|
Returns
Promise<number>
number of records relinked