This repository was archived by the owner on Apr 15, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ describe('lib/FileSystem', function() {
84
84
85
85
} ) ;
86
86
87
- it ( '#getFileNameFromUrl should create a sha1 filename from a PNG/JPG/GIF url.' , ( ) => {
87
+ it ( '#getFileNameFromUrl should create a sha1 filename from a PNG/JPG/GIF/BMP url.' , ( ) => {
88
88
89
89
const fileSystem = FileSystemFactory ( ) ;
90
90
@@ -100,6 +100,24 @@ describe('lib/FileSystem', function() {
100
100
101
101
jpgFilename . should . equal ( '6adf4569ecc3bf8c378bb4d47b1995cd85c5a13c.jpg' ) ;
102
102
103
+ let bmpFilename = fileSystem . getFileNameFromUrl ( 'https://cdn-learn.adafruit.com/assets/assets/000/010/147/original/tiger.bmp' ) ;
104
+
105
+ bmpFilename . should . equal ( '282fb62d2caff367aff828ce21e79575733605c8.bmp' ) ;
106
+
107
+ } ) ;
108
+
109
+ it ( '#getFileNameFromUrl should handle urls with same pathname but different query strings or fragments as individual files.' , ( ) => {
110
+
111
+ const fileSystem = FileSystemFactory ( ) ;
112
+
113
+ const pngFilename = fileSystem . getFileNameFromUrl ( 'https://img.wennermedia.com/5333a62d-07db-432a-92e2-198cafa38a14-326adb1a-d8ed-4a5d-b37e-5c88883e1989.png?exampleparam=one&anotherparam=2#this-is-a-fragment' ) ;
114
+
115
+ pngFilename . should . equal ( '9eea25bf871c2333648080180f6b616a91ce1b09.png' ) ;
116
+
117
+ const pngFilenameTwo = fileSystem . getFileNameFromUrl ( 'https://img.wennermedia.com/5333a62d-07db-432a-92e2-198cafa38a14-326adb1a-d8ed-4a5d-b37e-5c88883e1989.png?exampleparam=DIFFERENT&anotherparam=2#this-is-a-fragment-two' ) ;
118
+
119
+ pngFilenameTwo . should . equal ( '09091b8880ddb982968a0fe28abed5034f9a43b8.png' ) ;
120
+
103
121
} ) ;
104
122
105
123
it ( '#getLocalFilePathFromUrl should return local filepath if it exists on local fs in permanent dir.' , ( ) => {
You can’t perform that action at this time.
0 commit comments