@kesha-antonov/react-native-background-downloader 4.5.5 → 4.5.6

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.
@@ -1588,7 +1588,7 @@ RCT_EXPORT_METHOD(getExistingDownloadTasks: (RCTPromiseResolveBlock)resolve reje
1588
1588
  NSString *method = options.method() ? options.method() : @"POST";
1589
1589
  NSString *metadata = options.metadata() ? options.metadata() : @"";
1590
1590
  NSDictionary *headers = options.headers() ? (NSDictionary *)options.headers() : nil;
1591
- NSString *fieldName = options.fieldName() ? options.fieldName() : @"file";
1591
+ NSString *fieldName = options.fieldName() ? options.fieldName() : nil;
1592
1592
  NSString *mimeType = options.mimeType() ? options.mimeType() : nil;
1593
1593
  NSDictionary *parameters = options.parameters() ? (NSDictionary *)options.parameters() : nil;
1594
1594
 
@@ -1610,7 +1610,7 @@ RCT_EXPORT_METHOD(upload:(NSDictionary *)options) {
1610
1610
  NSString *method = options[@"method"] ?: @"POST";
1611
1611
  NSString *metadata = options[@"metadata"] ?: @"";
1612
1612
  NSDictionary *headers = options[@"headers"];
1613
- NSString *fieldName = options[@"fieldName"] ?: @"file";
1613
+ NSString *fieldName = options[@"fieldName"];
1614
1614
  NSString *mimeType = options[@"mimeType"];
1615
1615
  NSDictionary *parameters = options[@"parameters"];
1616
1616
 
@@ -1697,8 +1697,9 @@ RCT_EXPORT_METHOD(upload:(NSDictionary *)options) {
1697
1697
  NSString *filename = [source lastPathComponent];
1698
1698
  NSString *contentType = mimeType ?: @"application/octet-stream";
1699
1699
 
1700
+ NSString *multipartFieldName = fieldName ?: @"file";
1700
1701
  [body appendData:[[NSString stringWithFormat:@"--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
1701
- [body appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"%@\"; filename=\"%@\"\r\n", fieldName, filename] dataUsingEncoding:NSUTF8StringEncoding]];
1702
+ [body appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"%@\"; filename=\"%@\"\r\n", multipartFieldName, filename] dataUsingEncoding:NSUTF8StringEncoding]];
1702
1703
  [body appendData:[[NSString stringWithFormat:@"Content-Type: %@\r\n\r\n", contentType] dataUsingEncoding:NSUTF8StringEncoding]];
1703
1704
 
1704
1705
  NSData *fileData = [NSData dataWithContentsOfFile:source];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kesha-antonov/react-native-background-downloader",
3
- "version": "4.5.5",
3
+ "version": "4.5.6",
4
4
  "description": "A library for React-Native to help you download large files on iOS and Android both in the foreground and most importantly in the background.",
5
5
  "keywords": [
6
6
  "react-native",
@@ -55,10 +55,10 @@
55
55
  "lint": "eslint .",
56
56
  "typecheck": "tsc src/*.ts --noEmit --strict --skipLibCheck",
57
57
  "build": "rm -rf lib && tsc -p tsconfig.build.json",
58
- "prepare": "npm run build",
58
+ "prepare": "npm run build && npm run build-plugin",
59
59
  "prepublishOnly": "npm run build-plugin && npm run build && npm run typecheck && jest && npm run lint",
60
60
  "build-plugin": "tsc plugin/src/index.ts --outDir plugin/build --target ES2018 --module commonjs --declaration --esModuleInterop --strict --skipLibCheck",
61
- "publish": "npm publish",
61
+ "release": "npm publish",
62
62
  "test": "jest"
63
63
  },
64
64
  "lint-staged": {