@@ -132,14 +132,6 @@ function redactConfigurationValue(
132132 redactedCount : { value : number } ,
133133 depth = 0 ,
134134) : unknown {
135- if ( typeof value === "string" ) {
136- const redacted = redactUrlCredentials ( value ) ;
137- if ( redacted !== value ) {
138- redactedPaths . push ( path ) ;
139- redactedCount . value += 1 ;
140- }
141- return redacted ;
142- }
143135 if ( depth >= MAX_REDACT_DEPTH ) {
144136 // Fail closed. A deeply nested configuration shape is not needed to render
145137 // any built-in layer, and returning it unchanged would let a credential
@@ -148,12 +140,21 @@ function redactConfigurationValue(
148140 redactedCount . value += 1 ;
149141 return undefined ;
150142 }
143+ if ( typeof value === "string" ) {
144+ const redacted = redactUrlCredentials ( value ) ;
145+ if ( redacted !== value ) {
146+ redactedPaths . push ( path ) ;
147+ redactedCount . value += 1 ;
148+ }
149+ return redacted ;
150+ }
151151 if ( Array . isArray ( value ) ) {
152152 return value . map ( ( item , index ) =>
153153 redactConfigurationValue ( item , `${ path } [${ index } ]` , redactedPaths , redactedCount , depth + 1 ) ,
154154 ) ;
155155 }
156- if ( ! isPlainObject ( value ) || isGeoJsonPayload ( value ) ) return value ;
156+ if ( ! isPlainObject ( value ) ) return value ;
157+ if ( isGeoJsonPayload ( value ) ) return structuredClone ( value ) ;
157158
158159 const result : Record < string , unknown > = { } ;
159160 for ( const [ key , nested ] of Object . entries ( value ) ) {
@@ -206,14 +207,23 @@ export function redactProjectCredentials(project: GeoLibreProject): CredentialRe
206207 redactedPaths . push ( "basemapStyleUrl" ) ;
207208 redactedCount . value += 1 ;
208209 }
209- const preferences = project . preferences
210- ? {
211- ...project . preferences ,
212- environmentVariables : [ ] ,
213- geocoding : project . preferences . geocoding
214- ? { ...project . preferences . geocoding , apiKeys : { } }
215- : project . preferences . geocoding ,
210+ const geocoding = project . preferences ?. geocoding
211+ ? { ...project . preferences . geocoding , apiKeys : { } }
212+ : project . preferences ?. geocoding ;
213+ if ( geocoding ) {
214+ for ( const field of [ "forwardEndpoint" , "reverseEndpoint" ] as const ) {
215+ const endpoint = geocoding [ field ] ;
216+ if ( typeof endpoint !== "string" ) continue ;
217+ const redacted = redactUrlCredentials ( endpoint ) ;
218+ if ( redacted !== endpoint ) {
219+ geocoding [ field ] = redacted ;
220+ redactedPaths . push ( `preferences.geocoding.${ field } ` ) ;
221+ redactedCount . value += 1 ;
216222 }
223+ }
224+ }
225+ const preferences = project . preferences
226+ ? { ...project . preferences , environmentVariables : [ ] , geocoding }
217227 : project . preferences ;
218228 if ( project . preferences ?. environmentVariables ?. length > 0 ) {
219229 redactedPaths . push ( "preferences.environmentVariables" ) ;
0 commit comments