File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -130,7 +130,7 @@ export async function errorHandleDataFunction(
130130 const options = getClient ( ) ?. getOptions ( ) as RemixOptions | undefined ;
131131
132132 if ( options ?. sendDefaultPii && options . captureActionFormDataKeys ) {
133- await storeFormDataKeys ( args , span ) ;
133+ await storeFormDataKeys ( args , span , options . captureActionFormDataKeys ) ;
134134 }
135135 }
136136
Original file line number Diff line number Diff line change @@ -8,7 +8,11 @@ import type { ServerRoute, ServerRouteManifest } from './vendor/types';
88/**
99 *
1010 */
11- export async function storeFormDataKeys ( args : LoaderFunctionArgs | ActionFunctionArgs , span : Span ) : Promise < void > {
11+ export async function storeFormDataKeys (
12+ args : LoaderFunctionArgs | ActionFunctionArgs ,
13+ span : Span ,
14+ formDataKeys ?: Record < string , string | boolean > | undefined ,
15+ ) : Promise < void > {
1216 try {
1317 // We clone the request for Remix be able to read the FormData later.
1418 const clonedRequest = args . request . clone ( ) ;
@@ -19,7 +23,17 @@ export async function storeFormDataKeys(args: LoaderFunctionArgs | ActionFunctio
1923 const formData = await clonedRequest . formData ( ) ;
2024
2125 formData . forEach ( ( value , key ) => {
22- span . setAttribute ( `remix.action_form_data.${ key } ` , typeof value === 'string' ? value : '[non-string value]' ) ;
26+ let attrKey = key ;
27+
28+ if ( formDataKeys ?. [ key ] ) {
29+ if ( formDataKeys [ key ] === false ) {
30+ return ;
31+ } else if ( typeof value === 'string' ) {
32+ attrKey = key ;
33+ }
34+
35+ span . setAttribute ( `remix.action_form_data.${ attrKey } ` , typeof value === 'string' ? value : '[non-string value]' ) ;
36+ }
2337 } ) ;
2438 } catch ( e ) {
2539 DEBUG_BUILD && logger . warn ( 'Failed to read FormData from request' , e ) ;
You can’t perform that action at this time.
0 commit comments