-
Notifications
You must be signed in to change notification settings - Fork 1
atmosphere_pre_upload_blob
github-actions[bot] edited this page Jul 14, 2026
·
3 revisions
Short-circuits the uploadBlob call before it reaches the PDS.
Return a non-null array (the PDS success shape, e.g.
[ 'blob' => [...] ]) or a WP_Error to bypass the real HTTP
round-trip. Mirrors atmosphere_pre_apply_writes: the real
upload runs inside wp_safe_remote_request after a DPoP proof
has been built, so test environments and the FOSSE harness use
this filter to observe or mock the upload without a live PDS.
/**
* Short-circuits the uploadBlob call before it reaches the PDS.
*
* Return a non-null array (the PDS success shape, e.g.
* `[ 'blob' => [...] ]`) or a `WP_Error` to bypass the real HTTP
* round-trip. Mirrors `atmosphere_pre_apply_writes`: the real
* upload runs inside `wp_safe_remote_request` after a DPoP proof
* has been built, so test environments and the FOSSE harness use
* this filter to observe or mock the upload without a live PDS.
*
* @param null|array|\WP_Error $short_circuit
* @param string $file_path
* @param string $mime_type
* @return null|array|\WP_Error The filtered value.
*/
function my_atmosphere_pre_upload_blob_callback( null|array|\WP_Error $short_circuit, string $file_path, string $mime_type ) {
// Your code here.
return $short_circuit;
}
add_filter( 'atmosphere_pre_upload_blob', 'my_atmosphere_pre_upload_blob_callback', 10, 3 );-
null|array|\WP_Error$short_circuitShort-circuit value. Return null to skip. -
string$file_pathLocal path of the file about to be uploaded. -
string$mime_typeMIME type of the file.
\apply_filters( 'atmosphere_pre_upload_blob', null, $file_path, $mime_type )