This repository was archived by the owner on Apr 15, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import { Platform } from 'react-native';
11
11
import pathLib from 'path' ;
12
12
import RNFetchBlob from 'react-native-fetch-blob' ;
13
13
import sha1 from 'crypto-js/sha1' ;
14
+ import URL from 'url-parse' ;
14
15
15
16
export class FileSystem {
16
17
@@ -138,7 +139,8 @@ export class FileSystem {
138
139
*/
139
140
getFileNameFromUrl ( url ) {
140
141
141
- let urlExt = url . split ( '.' ) . pop ( ) ;
142
+ const urlParts = new URL ( url ) ;
143
+ const urlExt = urlParts . pathname . split ( '.' ) . pop ( ) ;
142
144
143
145
let extension = null ;
144
146
switch ( urlExt ) {
@@ -156,6 +158,10 @@ export class FileSystem {
156
158
case 'JPEG' :
157
159
extension = 'jpg' ;
158
160
break ;
161
+ case 'BMP' :
162
+ case 'bmp' :
163
+ extension = 'bmp' ;
164
+ break ;
159
165
default :
160
166
throw new Error ( 'url has invalid file extension.' ) ;
161
167
}
Original file line number Diff line number Diff line change 59
59
"react-native-fetch-blob" : " 0.10.8" ,
60
60
"react-native-uuid" : " ^1.4.9" ,
61
61
"traverse" : " ^0.6.6" ,
62
+ "url-parse" : " ^1.2.0" ,
62
63
"validator" : " ^9.0.0"
63
64
}
64
65
}
Original file line number Diff line number Diff line change @@ -3696,6 +3696,10 @@ qs@~6.5.1:
3696
3696
version "6.5.1"
3697
3697
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.1.tgz#349cdf6eef89ec45c12d7d5eb3fc0c870343a6d8"
3698
3698
3699
+ querystringify@~1.0.0 :
3700
+ version "1.0.0"
3701
+ resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-1.0.0.tgz#6286242112c5b712fa654e526652bf6a13ff05cb"
3702
+
3699
3703
random-bytes@~1.0.0 :
3700
3704
version "1.0.0"
3701
3705
resolved "https://registry.yarnpkg.com/random-bytes/-/random-bytes-1.0.0.tgz#4f68a1dc0ae58bd3fb95848c30324db75d64360b"
@@ -4039,6 +4043,10 @@ require-uncached@^1.0.3:
4039
4043
caller-path "^0.1.0"
4040
4044
resolve-from "^1.0.0"
4041
4045
4046
+ requires-port@~1.0.0 :
4047
+ version "1.0.0"
4048
+ resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff"
4049
+
4042
4050
resolve-from@^1.0.0 :
4043
4051
version "1.0.1"
4044
4052
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226"
4675
4683
version "1.0.0"
4676
4684
resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec"
4677
4685
4686
+ url-parse@^1.2.0 :
4687
+ version "1.2.0"
4688
+ resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.2.0.tgz#3a19e8aaa6d023ddd27dcc44cb4fc8f7fec23986"
4689
+ dependencies :
4690
+ querystringify "~1.0.0"
4691
+ requires-port "~1.0.0"
4692
+
4678
4693
[email protected] , util-deprecate@~1.0.1:
4679
4694
version "1.0.2"
4680
4695
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
You can’t perform that action at this time.
0 commit comments