File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -65,8 +65,10 @@ export class Helper extends APIResource {
6565
6666 var transformationString = this . buildTransformationString ( opts . transformation ) ;
6767
68+ const addAsQuery = transformationUtils . addAsQueryParameter ( opts ) || isSrcParameterUsedForURL ;
69+
6870 if ( transformationString && transformationString . length ) {
69- if ( ! transformationUtils . addAsQueryParameter ( opts ) && ! isSrcParameterUsedForURL ) {
71+ if ( ! addAsQuery ) {
7072 urlObj . pathname = pathJoin ( [
7173 TRANSFORMATION_PARAMETER + transformationUtils . getChainTransformDelimiter ( ) + transformationString ,
7274 urlObj . pathname ,
@@ -86,11 +88,9 @@ export class Helper extends APIResource {
8688 // Add transformation parameter manually to avoid URL encoding
8789 // URLSearchParams.set() would encode commas and colons in transformation string,
8890 // It would work correctly but not very readable e.g., "w-300,h-400" is better than "w-300%2Ch-400"
89- if ( transformationString && transformationString . length ) {
90- if ( transformationUtils . addAsQueryParameter ( opts ) || isSrcParameterUsedForURL ) {
91- const separator = urlObj . searchParams . toString ( ) ? '&' : '?' ;
92- finalUrl = `${ finalUrl } ${ separator } ${ TRANSFORMATION_PARAMETER } =${ transformationString } ` ;
93- }
91+ if ( transformationString && transformationString . length && addAsQuery ) {
92+ const separator = urlObj . searchParams . toString ( ) ? '&' : '?' ;
93+ finalUrl = `${ finalUrl } ${ separator } ${ TRANSFORMATION_PARAMETER } =${ transformationString } ` ;
9494 }
9595
9696 // Then sign the URL if needed
You can’t perform that action at this time.
0 commit comments