@@ -14,7 +14,7 @@ export const extractPublicId = (link: string):string => {
1414 const parts = CLOUDINARY_REGEX . exec ( link )
1515
1616 return parts && parts . length > 2 ? parts [ parts . length - 2 ] : link
17- }
17+ }
1818
1919export const getSignature = ( signature ?: string ) => {
2020 if ( ! signature ) return ''
@@ -42,13 +42,13 @@ export const getSubDomain = (publicId: string, { cdnSubdomain = false, cname } :
4242 return cdnSubdomain ? `a${ publicId } .` : ''
4343}
4444
45- export const getPrefix = ( publicId : string , {
46- cloudName,
47- privateCdn = false ,
48- cdnSubdomain = false ,
49- secureDistribution,
50- cname,
51- secure = true ,
45+ export const getPrefix = ( publicId : string , {
46+ cloudName,
47+ privateCdn = false ,
48+ cdnSubdomain = false ,
49+ secureDistribution,
50+ cname,
51+ secure = true ,
5252} : CloudConfig ) :string => {
5353 const hasSecureDistribution = secure && secureDistribution && ! SHARED_CDNS . includes ( secureDistribution )
5454 const protocol = `http${ secure ? 's' : '' } ://`
@@ -95,11 +95,10 @@ export const getResourceType = ({
9595
9696const isUrl = ( str ) => str && ! ! str . match ( / ^ h t t p s ? : \/ / )
9797
98- export const getPathToAsset = ( publicId : string , { urlSuffix = '' , format = '' } : { urlSuffix ?: string , format ?: string } ) :string => {
98+ export const getPathToAsset = ( publicId : string , { urlSuffix = '' } : { urlSuffix ?: string } ) :string => {
9999 if ( isUrl ( publicId ) ) return encodePublicId ( publicId )
100100
101- const publicIdWithFormat = publicId . replace ( / \. [ ^ / . ] + $ / , format || '' )
102- const path = [ publicIdWithFormat , urlSuffix ] . filter ( Boolean ) . join ( '/' )
101+ const path = [ publicId , urlSuffix ] . filter ( Boolean ) . join ( '/' )
103102
104103 return encodePublicId ( path )
105104}
@@ -111,7 +110,7 @@ export const url = (publicId: string, cloud: CloudConfig = { cloudName: ''}, opt
111110
112111 //If publicId is cloudinary url, strip to get the publicId and version.
113112 const _publicId = isUrl ( publicId ) ? extractPublicId ( publicId ) : publicId
114-
113+
115114 //1. Get version
116115 const version :string = getVersion ( _publicId , cloud )
117116 //2. Get Prefix
@@ -121,7 +120,7 @@ export const url = (publicId: string, cloud: CloudConfig = { cloudName: ''}, opt
121120 //4. Get Resource type
122121 const typePath :string = getResourceType ( cloud )
123122 //5. Get path
124- const pathToAsset :string = getPathToAsset ( _publicId , { format : options . format , urlSuffix : cloud . urlSuffix } )
123+ const pathToAsset :string = getPathToAsset ( _publicId , { urlSuffix : cloud . urlSuffix } )
125124 //6. Encode everything with %20 for whitespace
126125
127126 const format = options . fetchFormat || options . format || 'auto'
0 commit comments