File tree Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ def build_url(self, options: dict) -> str:
46
46
47
47
# if path is present then it is given priority over src parameter
48
48
if path :
49
- if transformation_position == "path" :
49
+ if transformation_position == "path" and len ( transformation_str ) != 0 :
50
50
temp_url = "{}/{}:{}/{}" .format (
51
51
url_endpoint ,
52
52
Default .TRANSFORMATION_PARAMETER .value ,
@@ -67,7 +67,7 @@ def build_url(self, options: dict) -> str:
67
67
68
68
query_params = dict (parse_qsl (url_object .query ))
69
69
query_params .update (options .get ("query_parameters" , {}))
70
- if transformation_position == Default .QUERY_TRANSFORMATION_POSITION .value :
70
+ if transformation_position == Default .QUERY_TRANSFORMATION_POSITION .value and len ( transformation_str ) != 0 :
71
71
query_params .update ({Default .TRANSFORMATION_PARAMETER .value : transformation_str })
72
72
query_params .update ({Default .SDK_VERSION_PARAMETER .value : Default .SDK_VERSION .value })
73
73
Original file line number Diff line number Diff line change @@ -488,3 +488,34 @@ def test_get_signature_without_expire_seconds_without_slash(self):
488
488
signature = self .client .url_obj .get_signature (
489
489
"private_key_test" , url , "https://test-domain.com/test-endpoint" , 0 )
490
490
self .assertEqual (signature , "41b3075c40bc84147eb71b8b49ae7fbf349d0f00" )
491
+
492
+
493
+ def test_generate_url_without_transforms (self ):
494
+ options = {
495
+ "path" : "/coffee.jpg" ,
496
+ "signed" : False ,
497
+ "expire_seconds" : 10
498
+ }
499
+
500
+ url = self .client .url (options )
501
+ self .assertEqual (
502
+ url ,
503
+ "https://test-domain.com/test-endpoint/coffee.jpg?ik-sdk-version={}" .format (
504
+ Default .SDK_VERSION .value
505
+ ),
506
+ )
507
+
508
+ def test_generate_url_without_transforms_src (self ):
509
+ options = {
510
+ "src" : "https://test-domain.com/test-endpoint/coffee.jpg" ,
511
+ "signed" : False ,
512
+ "expire_seconds" : 10
513
+ }
514
+
515
+ url = self .client .url (options )
516
+ self .assertEqual (
517
+ url ,
518
+ "https://test-domain.com/test-endpoint/coffee.jpg?ik-sdk-version={}" .format (
519
+ Default .SDK_VERSION .value
520
+ ),
521
+ )
You can’t perform that action at this time.
0 commit comments