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

Fix android http upload bugs #185

Merged
merged 2 commits into from
Nov 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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