Skip to content

Commit d70d4a0

Browse files
dcalhounclaude
andcommitted
docs: clarify the processFile plan check is a cache-aware fallback
GutenbergKit validates uploads in the WebView against the site's allowedMimeTypes (fetched from /wp-block-editor/v1/settings and cached on disk) before the request reaches this delegate, so it rejects most disallowed types with its own localized message first. Document that this app-side check is a fallback for the cache-miss/undefined-settings path and can over-reject when its static MimeTypes table is stricter than the server's cached list. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent ada3932 commit d70d4a0

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

WordPress/src/main/java/org/wordpress/android/ui/posts/editor/GBKMediaUploadProcessor.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,14 @@ class GBKMediaUploadProcessor(
6161
): ProcessedProxyFile = withContext(ioDispatcher) {
6262
val resolvedMimeType = resolveMimeType(mimeType, filename)
6363

64-
// Reject types the site's plan doesn't allow (e.g. audio on free WP.com plans) with a
65-
// localized message instead of an opaque server-side error.
64+
// Fallback plan check. GutenbergKit's editor validates uploads in the WebView against the
65+
// site's allowedMimeTypes (from /wp-block-editor/v1/settings) before the request reaches
66+
// this delegate, so for most disallowed types the editor rejects with its own localized
67+
// message first. Those settings are cached on disk and reused on later opens, so GB
68+
// validates against whatever mime list was cached — not necessarily the site's current
69+
// one. This check still fires when GB's list is absent (cache miss where editor settings
70+
// resolve to undefined) or when the app's static MimeTypes table is stricter than the
71+
// server's list — in which case it can over-reject a type the server would accept.
6672
if (!mediaUtilsWrapper.isMimeTypeSupportedBySitePlan(site, resolvedMimeType)) {
6773
throw GBKMediaUploadException(appContext.getString(R.string.error_media_file_type_not_allowed))
6874
}

0 commit comments

Comments
 (0)