| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -51,21 +51,25 @@ void ResourceResolver::resolveNode(const std::string &method, const std::string | |||
| 51 | 51 | size_t nextparamIdx = url.find('&', reqparamIdx); | |
| 52 | 52 | ||
| 53 | 53 | // Get the "name=value" string | |
| 54 | - std::string param = url.substr(reqparamIdx, nextparamIdx - reqparamIdx); | ||
| 55 | - | ||
| 56 | - // Find the position where the string has to be split | ||
| 57 | - size_t nvSplitIdx = param.find('='); | ||
| 54 | + std::string param = nextparamIdx == std::string::npos ? | ||
| 55 | + url.substr(reqparamIdx) : | ||
| 56 | + url.substr(reqparamIdx, nextparamIdx - reqparamIdx); | ||
| 57 | + | ||
| 58 | + if (param.length() > 0) { | ||
| 59 | + // Find the position where the string has to be split | ||
| 60 | + size_t nvSplitIdx = param.find('='); | ||
| 61 | + | ||
| 62 | + // Use empty string if only name is set. /foo?bar&baz=1 will return "" for bar | ||
| 63 | + std::string name = urlDecode(param.substr(0, nvSplitIdx)); | ||
| 64 | + std::string value = ""; | ||
| 65 | + if (nvSplitIdx != std::string::npos) { | ||
| 66 | + value = urlDecode(param.substr(nvSplitIdx+1)); | ||
| 67 | + } | ||
| 58 | 68 | ||
| 59 | - // Use empty string if only name is set. /foo?bar&baz=1 will return "" for bar | ||
| 60 | - std::string name = param.substr(0, nvSplitIdx); | ||
| 61 | - std::string value = ""; | ||
| 62 | - if (nvSplitIdx != std::string::npos) { | ||
| 63 | - value = urlDecode(param.substr(nvSplitIdx+1)); | ||
| 69 | + // Now we finally have name and value. | ||
| 70 | + params->setQueryParameter(name, value); | ||
| 64 | 71 | } | |
| 65 | 72 | ||
| 66 | - // Now we finally have name and value. | ||
| 67 | - params->setQueryParameter(name, value); | ||
| 68 | - | ||
| 69 | 73 | // Update reqparamIdx | |
| 70 | 74 | reqparamIdx = nextparamIdx; | |
| 71 | 75 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments