Skip to content

Commit a4e64e0

Browse files
authored
Merge pull request #5 from passlickdev/dev/1.0.4
fix: sanitize additional input
2 parents 8047e19 + 555b5f1 commit a4e64e0

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

modes/DEFAULT.yaml.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ strip_prefix: false
2121

2222
# ADDITIONAL INPUT
2323
enable_input: false
24+
eval_mathops: false

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "scanner-cli"
7-
version = "1.0.3"
7+
version = "1.0.4"
88
description = "CLI tool to read barcodes via stdin and route them to REST endpoints based on configurable modes."
99
readme = "README.md"
1010
authors = [{ name = "Passlick Development", email = "hello@passlickdev.com" }]

scanner_cli/main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def _eval_mathops(expr: str):
103103
_ANSI_CSI_RE = re.compile(r"\x1B\[[0-?]*[ -/]*[@-~]")
104104

105105

106-
def sanitize_barcode(value: str) -> str:
106+
def sanitize_input(value: str) -> str:
107107
if not value:
108108
return value
109109
cleaned = _ANSI_CSI_RE.sub("", value)
@@ -230,7 +230,7 @@ def schedule_timeout():
230230
if line == '':
231231
log_event("stdin_eof")
232232
break
233-
barcode = sanitize_barcode(line.strip())
233+
barcode = sanitize_input(line.strip())
234234
if not barcode:
235235
continue
236236

@@ -303,7 +303,7 @@ def schedule_timeout():
303303
evaluated = extra
304304
else:
305305
evaluated = extra
306-
payload["input"] = evaluated
306+
payload["input"] = sanitize_input(evaluated)
307307
payload["action"] = "scan+input"
308308

309309
try:

0 commit comments

Comments
 (0)