MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / is_rest_path

Function is_rest_path

internal/cbm/helpers.c:2072–2095  ·  view source on GitHub ↗

Check if a slash-prefixed string looks like a REST API path.

Source from the content-addressed store, hash-verified

2070
2071// Check if a slash-prefixed string looks like a REST API path.
2072static bool is_rest_path(const char *s, int len) {
2073 if (is_filesystem_path(s, len)) {
2074 return false;
2075 }
2076 if (len > SKIP_ONE && s[len - SKIP_ONE] == '/') {
2077 return false; /* regex pattern */
2078 }
2079 if (s[SKIP_ONE] == '^') {
2080 return false; /* regex */
2081 }
2082 if (len == SKIP_ONE || (len == PAIR_LEN && s[SKIP_ONE] == '/')) {
2083 return false; /* bare / or // */
2084 }
2085 if (s[SKIP_ONE] == '.') {
2086 return false; /* relative path */
2087 }
2088 for (int i = SKIP_ONE; i < len && i < MAX_ROUTE_SCAN; i++) {
2089 char c = s[i];
2090 if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9')) {
2091 return true;
2092 }
2093 }
2094 return false;
2095}
2096
2097static bool is_url_like(const char *s, int len) {
2098 if (len < MIN_ROUTE_LEN) {

Callers 1

is_url_likeFunction · 0.85

Calls 1

is_filesystem_pathFunction · 0.85

Tested by

no test coverage detected