expo-file-system 15.2.0 → 15.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +8 -1
- package/android/build.gradle +3 -3
- package/ios/EXFileSystem/EXFileSystem.m +18 -17
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,12 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 15.2.1 — 2023-02-09
|
|
14
|
+
|
|
15
|
+
### 🐛 Bug fixes
|
|
16
|
+
|
|
17
|
+
- Add utf-8 uri support on iOS. ([#21098](https://github.com/expo/expo/pull/21098) by [@gabrieldonadel](https://github.com/gabrieldonadel))
|
|
18
|
+
|
|
13
19
|
## 15.2.0 — 2023-02-03
|
|
14
20
|
|
|
15
21
|
### 💡 Others
|
package/README.md
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
<p>
|
|
2
|
+
<a href="https://docs.expo.dev/versions/latest/sdk/filesystem/">
|
|
3
|
+
<img
|
|
4
|
+
src="../../.github/resources/expo-file-system.svg"
|
|
5
|
+
alt="expo-file-system"
|
|
6
|
+
height="64" />
|
|
7
|
+
</a>
|
|
8
|
+
</p>
|
|
2
9
|
|
|
3
10
|
Provides access to the local file system on the device.
|
|
4
11
|
|
package/android/build.gradle
CHANGED
|
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
|
|
|
3
3
|
apply plugin: 'maven-publish'
|
|
4
4
|
|
|
5
5
|
group = 'host.exp.exponent'
|
|
6
|
-
version = '15.2.
|
|
6
|
+
version = '15.2.1'
|
|
7
7
|
|
|
8
8
|
buildscript {
|
|
9
9
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
@@ -22,7 +22,7 @@ buildscript {
|
|
|
22
22
|
if (ext.has("kotlinVersion")) {
|
|
23
23
|
ext.kotlinVersion()
|
|
24
24
|
} else {
|
|
25
|
-
ext.safeExtGet("kotlinVersion", "1.
|
|
25
|
+
ext.safeExtGet("kotlinVersion", "1.8.10")
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -74,7 +74,7 @@ android {
|
|
|
74
74
|
minSdkVersion safeExtGet("minSdkVersion", 21)
|
|
75
75
|
targetSdkVersion safeExtGet("targetSdkVersion", 33)
|
|
76
76
|
versionCode 30
|
|
77
|
-
versionName "15.2.
|
|
77
|
+
versionName "15.2.1"
|
|
78
78
|
}
|
|
79
79
|
lintOptions {
|
|
80
80
|
abortOnError false
|
|
@@ -179,11 +179,7 @@ EX_EXPORT_METHOD_AS(getInfoAsync,
|
|
|
179
179
|
resolver:(EXPromiseResolveBlock)resolve
|
|
180
180
|
rejecter:(EXPromiseRejectBlock)reject)
|
|
181
181
|
{
|
|
182
|
-
NSURL *uri = [NSURL
|
|
183
|
-
// no scheme provided in uri, handle as a local path and add 'file://' scheme
|
|
184
|
-
if (!uri.scheme) {
|
|
185
|
-
uri = [NSURL fileURLWithPath:uriString isDirectory:false];
|
|
186
|
-
}
|
|
182
|
+
NSURL *uri = [NSURL fileURLWithPath:[self removeFileSchemefromURIString:uriString]];
|
|
187
183
|
if (!([self permissionsForURI:uri] & EXFileSystemPermissionRead)) {
|
|
188
184
|
reject(@"ERR_FILESYSTEM_NO_PERMISSIONS",
|
|
189
185
|
[NSString stringWithFormat:@"File '%@' isn't readable.", uri],
|
|
@@ -208,11 +204,7 @@ EX_EXPORT_METHOD_AS(readAsStringAsync,
|
|
|
208
204
|
resolver:(EXPromiseResolveBlock)resolve
|
|
209
205
|
rejecter:(EXPromiseRejectBlock)reject)
|
|
210
206
|
{
|
|
211
|
-
NSURL *uri = [NSURL
|
|
212
|
-
// no scheme provided in uri, handle as a local path and add 'file://' scheme
|
|
213
|
-
if (!uri.scheme) {
|
|
214
|
-
uri = [NSURL fileURLWithPath:uriString isDirectory:false];
|
|
215
|
-
}
|
|
207
|
+
NSURL *uri = [NSURL fileURLWithPath:[self removeFileSchemefromURIString:uriString]];
|
|
216
208
|
if (!([self permissionsForURI:uri] & EXFileSystemPermissionRead)) {
|
|
217
209
|
reject(@"ERR_FILESYSTEM_NO_PERMISSIONS",
|
|
218
210
|
[NSString stringWithFormat:@"File '%@' isn't readable.", uri],
|
|
@@ -275,7 +267,7 @@ EX_EXPORT_METHOD_AS(writeAsStringAsync,
|
|
|
275
267
|
resolver:(EXPromiseResolveBlock)resolve
|
|
276
268
|
rejecter:(EXPromiseRejectBlock)reject)
|
|
277
269
|
{
|
|
278
|
-
NSURL *uri = [NSURL
|
|
270
|
+
NSURL *uri = [NSURL fileURLWithPath:[self removeFileSchemefromURIString:uriString]];
|
|
279
271
|
if (!([self permissionsForURI:uri] & EXFileSystemPermissionWrite)) {
|
|
280
272
|
reject(@"ERR_FILESYSTEM_NO_PERMISSIONS",
|
|
281
273
|
[NSString stringWithFormat:@"File '%@' isn't writable.", uri],
|
|
@@ -335,7 +327,7 @@ EX_EXPORT_METHOD_AS(deleteAsync,
|
|
|
335
327
|
resolver:(EXPromiseResolveBlock)resolve
|
|
336
328
|
rejecter:(EXPromiseRejectBlock)reject)
|
|
337
329
|
{
|
|
338
|
-
NSURL *uri = [NSURL
|
|
330
|
+
NSURL *uri = [NSURL fileURLWithPath:[self removeFileSchemefromURIString:uriString]];
|
|
339
331
|
if (!([self permissionsForURI:[uri URLByAppendingPathComponent:@".."]] & EXFileSystemPermissionWrite)) {
|
|
340
332
|
reject(@"ERR_FILESYSTEM_NO_PERMISSIONS",
|
|
341
333
|
[NSString stringWithFormat:@"Location '%@' isn't deletable.", uri],
|
|
@@ -472,7 +464,7 @@ EX_EXPORT_METHOD_AS(makeDirectoryAsync,
|
|
|
472
464
|
rejecter:(EXPromiseRejectBlock)reject)
|
|
473
465
|
{
|
|
474
466
|
|
|
475
|
-
NSURL *uri = [NSURL
|
|
467
|
+
NSURL *uri = [NSURL fileURLWithPath:[self removeFileSchemefromURIString:uriString]];
|
|
476
468
|
if (!([self permissionsForURI:uri] & EXFileSystemPermissionWrite)) {
|
|
477
469
|
reject(@"ERR_FILESYSTEM_NO_PERMISSIONS",
|
|
478
470
|
[NSString stringWithFormat:@"Directory '%@' could not be created because the location isn't writable.", uri],
|
|
@@ -505,7 +497,7 @@ EX_EXPORT_METHOD_AS(readDirectoryAsync,
|
|
|
505
497
|
resolver:(EXPromiseResolveBlock)resolve
|
|
506
498
|
rejecter:(EXPromiseRejectBlock)reject)
|
|
507
499
|
{
|
|
508
|
-
NSURL *uri = [NSURL
|
|
500
|
+
NSURL *uri = [NSURL fileURLWithPath:[self removeFileSchemefromURIString:uriString] isDirectory:true];
|
|
509
501
|
if (!([self permissionsForURI:uri] & EXFileSystemPermissionRead)) {
|
|
510
502
|
reject(@"ERR_FILESYSTEM_NO_PERMISSIONS",
|
|
511
503
|
[NSString stringWithFormat:@"Location '%@' isn't readable.", uri],
|
|
@@ -538,7 +530,7 @@ EX_EXPORT_METHOD_AS(downloadAsync,
|
|
|
538
530
|
rejecter:(EXPromiseRejectBlock)reject)
|
|
539
531
|
{
|
|
540
532
|
NSURL *url = [NSURL URLWithString:urlString];
|
|
541
|
-
NSURL *localUri = [NSURL
|
|
533
|
+
NSURL *localUri = [NSURL fileURLWithPath:[self removeFileSchemefromURIString:localUriString]];
|
|
542
534
|
if (!([self checkIfFileDirExists:localUri.path])) {
|
|
543
535
|
reject(@"ERR_FILESYSTEM_WRONG_DESTINATION",
|
|
544
536
|
[NSString stringWithFormat:@"Directory for '%@' doesn't exist. Please make sure directory '%@' exists before calling downloadAsync.", localUriString, [localUri.path stringByDeletingLastPathComponent]],
|
|
@@ -635,7 +627,7 @@ EX_EXPORT_METHOD_AS(uploadTaskStartAsync,
|
|
|
635
627
|
options:(NSDictionary *)options
|
|
636
628
|
rejecter:(EXPromiseRejectBlock)reject
|
|
637
629
|
{
|
|
638
|
-
NSURL *fileUri = [NSURL
|
|
630
|
+
NSURL *fileUri = [NSURL fileURLWithPath:[self removeFileSchemefromURIString:fileUriString]];
|
|
639
631
|
NSString *httpMethod = options[@"httpMethod"];
|
|
640
632
|
EXFileSystemUploadType type = [self _getUploadTypeFrom:options[@"uploadType"]];
|
|
641
633
|
if (![fileUri.scheme isEqualToString:@"file"]) {
|
|
@@ -702,7 +694,7 @@ EX_EXPORT_METHOD_AS(downloadResumableStartAsync,
|
|
|
702
694
|
rejecter:(EXPromiseRejectBlock)reject)
|
|
703
695
|
{
|
|
704
696
|
NSURL *url = [NSURL URLWithString:urlString];
|
|
705
|
-
NSURL *localUrl = [NSURL
|
|
697
|
+
NSURL *localUrl = [NSURL fileURLWithPath:[self removeFileSchemefromURIString:fileUri]];
|
|
706
698
|
if (!([self checkIfFileDirExists:localUrl.path])) {
|
|
707
699
|
reject(@"ERR_FILESYSTEM_WRONG_DESTINATION",
|
|
708
700
|
[NSString stringWithFormat:@"Directory for '%@' doesn't exist. Please make sure directory '%@' exists before calling downloadAsync.", fileUri, [localUrl.path stringByDeletingLastPathComponent]],
|
|
@@ -1012,6 +1004,15 @@ EX_EXPORT_METHOD_AS(getTotalDiskCapacityAsync, getTotalDiskCapacityAsyncWithReso
|
|
|
1012
1004
|
return [self _checkIfFileExists:dir];
|
|
1013
1005
|
}
|
|
1014
1006
|
|
|
1007
|
+
- (NSString *)removeFileSchemefromURIString:(NSString *)path
|
|
1008
|
+
{
|
|
1009
|
+
if ([path hasPrefix:@"file:///"]) {
|
|
1010
|
+
return [path substringFromIndex:7];
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
return [path copy];
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1015
1016
|
#pragma mark - Class methods
|
|
1016
1017
|
|
|
1017
1018
|
- (BOOL)ensureDirExistsWithPath:(NSString *)path
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-file-system",
|
|
3
|
-
"version": "15.2.
|
|
3
|
+
"version": "15.2.1",
|
|
4
4
|
"description": "Provides access to the local file system on the device.",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"expo": "*"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "1f8a6a09570fd451378565ca34933018ce48454e"
|
|
48
48
|
}
|