| 701 | } |
| 702 | |
| 703 | String WebDAVHandler::getDestinationPath(WebServer& s) const { |
| 704 | String dest = s.header("Destination"); |
| 705 | if (dest.isEmpty()) return ""; |
| 706 | |
| 707 | // Extract path from full URL: http://host/path -> /path |
| 708 | // Find the third slash (after http://) |
| 709 | int schemeEnd = dest.indexOf("://"); |
| 710 | if (schemeEnd >= 0) { |
| 711 | int pathStart = dest.indexOf('/', schemeEnd + 3); |
| 712 | if (pathStart >= 0) { |
| 713 | dest = dest.substring(pathStart); |
| 714 | } else { |
| 715 | dest = "/"; |
| 716 | } |
| 717 | } |
| 718 | |
| 719 | String decoded = WebServer::urlDecode(dest); |
| 720 | std::string normalized = FsHelpers::normalisePath(decoded.c_str()); |
| 721 | String result = normalized.c_str(); |
| 722 | |
| 723 | if (result.isEmpty()) return "/"; |
| 724 | if (!result.startsWith("/")) result = "/" + result; |
| 725 | |
| 726 | // Remove trailing slash unless root |
| 727 | if (result.length() > 1 && result.endsWith("/")) { |
| 728 | result = result.substring(0, result.length() - 1); |
| 729 | } |
| 730 | |
| 731 | return result; |
| 732 | } |
| 733 | |
| 734 | void WebDAVHandler::urlEncodePath(const String& path, String& out) const { |
| 735 | out = ""; |
nothing calls this directly
no test coverage detected