Skip to content
This repository has been archived by the owner on Sep 26, 2022. It is now read-only.

Commit

Permalink
Fix android http upload bugs (#185)
Browse files Browse the repository at this point in the history
* Fix Http.uploadFile not allowing a file:// source

* Fix Http.uploadFile erroring if method not supplied on android

Co-authored-by: Lee Houghton <lee.houghton@connectchildcare.com>
  • Loading branch information
asztal and asztal authored Nov 9, 2021
1 parent 104f7d2 commit 5ca386c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class FilesystemUtils {
public static final String DIRECTORY_EXTERNAL_STORAGE = "EXTERNAL_STORAGE";

public static File getFileObject(Context c, String path, String directory) {
if (directory == null) {
if (directory == null || path.startsWith("file://")) {
Uri u = Uri.parse(path);
if (u.getScheme() == null || u.getScheme().equals("file")) {
return new File(u.getPath());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ public static JSObject downloadFile(PluginCall call, Context context, ProgressEm
*/
public static JSObject uploadFile(PluginCall call, Context context) throws IOException, URISyntaxException, JSONException {
String urlString = call.getString("url");
String method = call.getString("method").toUpperCase();
String method = call.getString("method", "POST").toUpperCase();
String filePath = call.getString("filePath");
String fileDirectory = call.getString("fileDirectory", FilesystemUtils.DIRECTORY_DOCUMENTS);
String name = call.getString("name", "file");
Expand Down

0 comments on commit 5ca386c

Please sign in to comment.