URL-encode each path segment but preserve '/' separators
| 54 | |
| 55 | // URL-encode each path segment but preserve '/' separators |
| 56 | std::string OneDriveProvider::EncodePath(const std::string& path) { |
| 57 | std::string out; |
| 58 | size_t start = 0; |
| 59 | while (start < path.size()) { |
| 60 | size_t slash = path.find('/', start); |
| 61 | std::string seg = (slash != std::string::npos) |
| 62 | ? path.substr(start, slash - start) |
| 63 | : path.substr(start); |
| 64 | if (!seg.empty()) |
| 65 | out += UrlEncode(seg); |
| 66 | if (slash != std::string::npos) { |
| 67 | out += '/'; |
| 68 | start = slash + 1; |
| 69 | } else { |
| 70 | break; |
| 71 | } |
| 72 | } |
| 73 | return out; |
| 74 | } |
| 75 | |
| 76 | // /me/drive/root:/CloudRedirect/{acct}/{app}/{filename}: |
| 77 | std::string OneDriveProvider::BuildItemPath(uint32_t accountId, uint32_t appId, |