File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,9 @@ Scraper.prototype = {
6060
6161 var parts = url . split ( "/" ) ;
6262 var filename = parts [ parts . length - 1 ] ;
63- filename = filename . split ( "?" ) [ 0 ] ;
63+ filename = filename . replace ( / \? / g, "%3F" ) ;
64+ filename = filename . replace ( / = / g, "%3D" ) ;
65+ filename = filename . replace ( / & / g, "%26" ) ;
6466 return filename ;
6567 } ,
6668
Original file line number Diff line number Diff line change @@ -202,8 +202,8 @@ describe("Scraper", function () {
202202
203203 it ( "should extract filename from image url with query string" , function ( ) {
204204
205- var image = Scraper . prototype . getFileFilename ( "http://example.com/image.jpg?123 " ) ;
206- expect ( image ) . toEqual ( "image.jpg" ) ;
205+ var image = Scraper . prototype . getFileFilename ( "http://example.com/image.jpg?a=1&b=2 " ) ;
206+ expect ( image ) . toEqual ( "image.jpg%3Fa%3D1%26b%3D2 " ) ;
207207 } ) ;
208208
209209 it ( "should extract filename from image url without http://" , function ( ) {
You can’t perform that action at this time.
0 commit comments