| 703 | } |
| 704 | |
| 705 | private String sanitizePath(String path) { |
| 706 | try { |
| 707 | String decodedPath = URLDecoder.decode( |
| 708 | path, |
| 709 | StandardCharsets.UTF_8.toString() |
| 710 | ); |
| 711 | String encodedPath = URLEncoder.encode( |
| 712 | decodedPath, |
| 713 | StandardCharsets.UTF_8.toString() |
| 714 | ) |
| 715 | .replace("+", "%20") // Replace + with %20 for spaces |
| 716 | .replace("%2F", "/") // Preserve forward slashes |
| 717 | .replace("%5C", "\\"); // Preserve backslashes if needed |
| 718 | |
| 719 | return encodedPath; |
| 720 | } catch (UnsupportedEncodingException e) { |
| 721 | return path; // Return original if encoding fails |
| 722 | } |
| 723 | } |
| 724 | |
| 725 | public void close(JSONArray args, CallbackContext callback) { |
| 726 | cordova |