File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -458,13 +458,23 @@ const RAW_SLOT_PATTERN = /\b(blob[1-9]|double[1-9])\b/gi;
458458/**
459459 * Reject queries that contain raw slot names (blob1..9 / double1..6).
460460 * Returns an error message string, or null if the query is clean.
461+ *
462+ * Single-quoted string literals are skipped so that values like
463+ * `'https://example.com/blob1/readme'` do not trigger a false rejection.
464+ * This matches the scoping rules used by `rewriteSqlToRaw`. SQL's
465+ * doubled-quote escape (`''`) is respected so that escaped quotes do not
466+ * terminate the literal prematurely.
461467 * Exported for unit testing.
462468 */
463469export function detectRawSlotNames (
464470 sql : string ,
465471 schemaMap : SchemaMap ,
466472) : string | null {
467- const matches = sql . match ( RAW_SLOT_PATTERN ) ;
473+ // Strip single-quoted string literals before scanning for raw slot names
474+ // so filter values containing substrings like `blob1` are not flagged.
475+ const literalPattern = / ' (?: [ ^ ' ] | ' ' ) * ' / g;
476+ const scannable = sql . replace ( literalPattern , "''" ) ;
477+ const matches = scannable . match ( RAW_SLOT_PATTERN ) ;
468478 if ( ! matches ) return null ;
469479
470480 const unique = [ ...new Set ( matches . map ( ( m ) => m . toLowerCase ( ) ) ) ] ;
You can’t perform that action at this time.
0 commit comments