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

Function is_rest_path

internal/cbm/helpers.c:1358–1381  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1356
1357// Check if a slash-prefixed string looks like a REST API path.
1358static bool is_rest_path(const char *s, int len) {
1359 if (is_filesystem_path(s, len)) {
1360 return false;
1361 }
1362 if (len > SKIP_ONE && s[len - SKIP_ONE] == '/') {
1363 return false; /* regex pattern */
1364 }
1365 if (s[SKIP_ONE] == '^') {
1366 return false; /* regex */
1367 }
1368 if (len == SKIP_ONE || (len == PAIR_LEN && s[SKIP_ONE] == '/')) {
1369 return false; /* bare / or // */
1370 }
1371 if (s[SKIP_ONE] == '.') {
1372 return false; /* relative path */
1373 }
1374 for (int i = SKIP_ONE; i < len && i < MAX_ROUTE_SCAN; i++) {
1375 char c = s[i];
1376 if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9')) {
1377 return true;
1378 }
1379 }
1380 return false;
1381}
1382
1383static bool is_url_like(const char *s, int len) {
1384 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