You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: improve connection string error handling for common copy-paste mistakes
Author: Dor Kohn
Context: Product Manager Home Assignment
- Add normalize_cloudinary_url() method to handle CLOUDINARY_URL= prefix
- Add angle bracket detection with helpful error message
- Update regex to support cloud names with underscores/hyphens/numbers
- Apply consistent normalization across wizard, settings, and upgrade flows
if ( $current['cloudinary_url'] === $data['cloudinary_url'] ) {
280
281
return$data;
281
282
}
282
283
284
+
// Check for angle brackets early with helpful message.
285
+
if ( preg_match( '/[<>]/', $data['cloudinary_url'] ) ) {
286
+
$admin->add_admin_notice(
287
+
'angle_brackets',
288
+
__( 'Your connection string contains angle brackets (< or >). Replace the placeholder values like <your_api_key> with your actual credentials.', 'cloudinary' ),
289
+
'error'
290
+
);
291
+
292
+
return$current;
293
+
}
294
+
283
295
// Pattern match to ensure validity of the provided url.
'Your connection string contains angle brackets (< or >). Replace the placeholder values like <your_api_key> with your actual credentials. The format should be: cloudinary://API_KEY:API_SECRET@CLOUD_NAME',
429
+
'cloudinary'
430
+
),
431
+
'url' => $url,
432
+
);
433
+
}
434
+
387
435
$result = array(
388
436
'type' => 'connection_success',
389
437
'message' => null,
@@ -903,7 +951,7 @@ public function upgrade_connection( $old_version ) {
0 commit comments