refactor(sessions): use _escape_like in _cwd_prefix_clause
Follow-up on the salvage of #78681 + #78927: the second fix inlined the exact body of the _escape_like helper the first fix introduced ten lines above. Call the helper instead so there is one copy of the escaping rule.
This commit is contained in:
parent
b37de01926
commit
4bab919446
|
|
@ -194,7 +194,7 @@ def _cwd_prefix_clause(cwd_prefix: str) -> Tuple[str, List[str]]:
|
|||
# Escape the needle and pair it with ESCAPE; the literal separator
|
||||
# backslash in the Windows pattern needs escaping for the same reason. The
|
||||
# ``=`` arm is an exact compare and keeps the raw prefix.
|
||||
esc = prefix.replace("\\", "\\\\").replace("%", "\\%").replace("_", "\\_")
|
||||
esc = _escape_like(prefix)
|
||||
return (
|
||||
"(s.cwd = ? OR s.cwd LIKE ? ESCAPE '\\' OR s.cwd LIKE ? ESCAPE '\\')",
|
||||
[prefix, f"{esc}/%", f"{esc}\\\\%"],
|
||||
|
|
|
|||
Loading…
Reference in New Issue