@@ -283,22 +283,15 @@ class CloudinaryFile {
283283 . replace ( / \? / g, '%3F' )
284284 . replace ( / = / g, '%3D' ) ;
285285
286- // TODO
287- // 1. First we have to check if `this.urlConfig.queryParams` is an object and therefore needs parsing
288- // 2. If we got an object we have to check if URLSearchParams is available, and only then use it
289- // Beause we want to throw a meaningful Error in case it's not - we can wrap the below code in a try catch clause
290- // 3. If it already was a string then we can skip the parsing but still we need to assign it to `queryParamsString`
291286
292287 const shouldAddAnalytics = this . urlConfig . analytics !== false && ! ( publicID . includes ( '?' ) ) ;
293288
294289 let queryParamsString = '' ;
295290
296- if ( typeof ( this . urlConfig . queryParams ) === 'object' ) { //#1
291+ if ( typeof ( this . urlConfig . queryParams ) === 'object' ) {
297292
298293 try {
299294 const queryParams = new URLSearchParams ( this . urlConfig . queryParams as Record < string , string > ) ;
300- // urlConfig.analytics is true by default, has to be explicitly set to false to overwrite
301- // Don't add analytics when publicId includes a '?' to not risk changing existing query params
302295
303296 if ( shouldAddAnalytics ) {
304297 queryParams . set ( "_a" , getSDKAnalyticsSignature ( trackedAnalytics ) ) ;
@@ -307,15 +300,10 @@ class CloudinaryFile {
307300 queryParamsString = queryParams . toString ( ) ;
308301
309302 } catch ( err ) {
310- //TODO: improve error message, consult with docs team.
311303 console . error ( "Error: URLSearchParams is not available" ) ;
312- //throw "Error: URLSearchParams is not available."; //#2
313304 }
314305 }
315-
316- //if (typeof(this.urlConfig.queryParams) === 'string'){ //#3
317- else { //#3
318- //assign to queryParamsString
306+ else {
319307 queryParamsString = this . urlConfig . queryParams || '' ;
320308
321309 if ( shouldAddAnalytics ) {
0 commit comments