fix(fal-image): normalize fullwidth colon in API credentials
This commit is contained in:
parent
c91486e1bb
commit
32d6d10f2e
@ -29,7 +29,11 @@ const DEFAULT_SAFETY_TOLERANCE = "4";
|
|||||||
const DEFAULT_TIMEOUT_MS = 180000;
|
const DEFAULT_TIMEOUT_MS = 180000;
|
||||||
|
|
||||||
function normalizeFalCredentials(apiKey: string) {
|
function normalizeFalCredentials(apiKey: string) {
|
||||||
const normalized = apiKey.replace(/\u00a0/g, " ").trim();
|
const normalized = apiKey
|
||||||
|
.replace(/\u00a0/g, " ")
|
||||||
|
.replace(/\u3000/g, " ")
|
||||||
|
.replace(/:/g, ":")
|
||||||
|
.trim();
|
||||||
const stripped = normalized.replace(/^bearer\s+/i, "").replace(/^key\s+/i, "");
|
const stripped = normalized.replace(/^bearer\s+/i, "").replace(/^key\s+/i, "");
|
||||||
const kvMatch = stripped.match(/^(?:fal[_-]?key|api[_-]?key|token)\s*[::]\s*(.+)$/i);
|
const kvMatch = stripped.match(/^(?:fal[_-]?key|api[_-]?key|token)\s*[::]\s*(.+)$/i);
|
||||||
if (kvMatch?.[1]) {
|
if (kvMatch?.[1]) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user