Repository navigation
Description
Parent: https://github.com/rtCamp/godam-plugin-wp/issues/23 · Owner: @subodhr258 · Release: 2.5.2 (https://github.com/rtCamp/godam-plugin-wp/issues/66) · Reported by: @kishan-gondaliya-7270
Fix PR: #2258
What it is
When a media picker is limited to caption files or documents, the GoDAM folder sidebar shows All Media 0, even when matching files exist. The request behind that number fails with HTTP 400, and the failure shows in the browser's Network tab.
Picking a file still works. The count is wrong and the failed request looks like a broken feature to anyone with DevTools open. This is not new in 2.5.0: it has been there since 1.10.0 (December 2025).
| Picker | Files it allows | All Media request | Sidebar shows |
|---|---|---|---|
| Video editor, Transcription tab, Upload File or Replace | .vtt, .srt, .txt | 400 | 0, with 1 caption file in the library |
| Document block | PDF, Word, Excel and other documents | 400 | 0 (checked through the REST route, not in the browser) |
| Video, audio and image pickers | one whole type, such as video |
200 | the right number |
Steps to reproduce
- Upload one .vtt file to the Media Library.
- Open the GoDAM video editor for any video, go to the Transcription tab and click Upload File (or Replace).
- In the picker's left sidebar, All Media shows 0 while Uncategorized shows 1.
- In DevTools > Network,
wp/v2/media?_fields=id&per_page=1&media_type=text/vtt,application/x-subrip,text/plainreturns 400 withmedia_type[0] is not one of image, video, text, application, and audio.
Expected: All Media shows 1 and no request fails.
The GoDAM tab in the same picker says "No items found". That is expected and not part of this bug: caption files are stored only in the WordPress Media Library, never in GoDAM cloud storage.
Cause
WordPress's media REST route takes two filters:
| Filter | Accepts | Example |
|---|---|---|
media_type |
only whole types | video, text, application |
mime_type |
only exact file types | text/vtt, application/pdf |
The sidebar always sends the picker's file types as media_type. That works for video, but WordPress rejects exact file types such as text/vtt with a 400.
Fix
When the filter has exact file types (with a /), count through admin-ajax query-attachments, the query the picker's own grid runs. Whole types and no filter stay on the REST route. Sending the list as mime_type instead only works from WordPress 6.9, and GoDAM supports 6.5. This is one function in the media library sidebar, plus unit tests.
Who builds what
@subodhr258: the fix, the test, and a check in the caption picker, the Document block picker and the normal Media Library page.
Estimate
About 2 hours of work. It ships with 2.5.2.
For agents / implementers
-
Bad call:
pages/media-library/redux/api/folders.js:71,getAllMediaCountusesgetCurrentMimeTypeFilter( 'media_type' )(pages/media-library/data/utilities.js:221), which passes the frame'slibrary.type(or thepost_mime_typeURL param) straight through. -
Callers that send exact file types:
pages/video-editor/components/transcription/Transcription.js:136([ 'text/vtt', 'application/x-subrip', 'text/plain' ]) and the Document block'sMediaUpload allowedTypes={ ALLOWED_MEDIA_TYPES }(assets/src/blocks/godam-pdf/constants.js, the keys ofSUPPORTED_DOCUMENT_TYPES). -
Core (WordPress 7.1.3,
wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php):media_typeis an array whose items are the enumimage, video, text, application, audio.mime_typeis an array of strings, andprepare_items_query()keeps an entry only when it is an exact allowed file type. A whole type such asvideosent asmime_typeis silently dropped, so the count becomes every attachment (checked:mime_type=videoreturned 70 of 70). So split, do not just rename the parameter. -
Checked on godam-dev, GoDAM 2.5.0 (
d9b98889), as admin with the REST nonce:Query Status X-WP-Total media_type=text/vtt,application/x-subrip,text/plain400 media_type=application/pdf400 media_type=video200 60 mime_type=text/vtt,application/x-subrip,text/plain(one .vtt uploaded)200 1 mime_type=application/pdf200 1 -
getCategoryMediaCountandgetFolderssend the same value aspost_mime_typeto GoDAM's own routes, which accept exact file types (Uncategorized showed 1), so they need no change. -
typecan be a string, a comma list or an array. Normalise first, then split on whether each entry contains/. Also try the Media Library page's Documents, Spreadsheets and Archives filters, which use lists of exact file types (not checked). -
Introduced by 3e75be8 (Media library extended issues #1353, 2025-12-05), first tagged 1.10.0.
Activity
kishan-gondaliya-7270 commentedon Oct 28, 2026
GoDAM Core doesn't support vtt file
Fix the All Media count in caption and document pickers (rtCamp#2258)