File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
packages/modules/providers/file-s3
integration-tests/__tests__ Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,23 @@ describe.skip("S3 File Plugin", () => {
9999 } )
100100 } )
101101
102+ it ( "uploads a file with special URL characters in the name" , async ( ) => {
103+ const fileContent = await fs . readFile ( fixtureImagePath )
104+ const fixtureAsBinary = fileContent . toString ( "base64" )
105+
106+ const resp = await s3Service . upload ( {
107+ filename : "cat?photo.jpg" ,
108+ mimeType : "image/jpeg" ,
109+ content : fixtureAsBinary ,
110+ access : "private" ,
111+ } )
112+
113+ expect ( resp ) . toEqual ( {
114+ key : expect . stringMatching ( / t e s t s \/ c a t p h o t o .* \. j p g / ) ,
115+ url : expect . stringMatching ( / h t t p s : \/ \/ .* \/ c a t % 3 F p h o t o .* \. j p g / ) ,
116+ } )
117+ } )
118+
102119 it ( "gets a presigned upload URL and uploads a file successfully" , async ( ) => {
103120 const fileContent = await fs . readFile ( fixtureImagePath )
104121 const fixtureAsBinary = fileContent . toString ( "binary" )
Original file line number Diff line number Diff line change @@ -160,7 +160,7 @@ export class S3FileService extends AbstractFileProviderService {
160160 }
161161
162162 return {
163- url : `${ this . config_ . fileUrl } /${ encodeURI ( fileKey ) } ` ,
163+ url : `${ this . config_ . fileUrl } /${ encodeURIComponent ( fileKey ) } ` ,
164164 key : fileKey ,
165165 }
166166 }
You can’t perform that action at this time.
0 commit comments