{"record":{"id":"00f65e302501e9ed","repo":"santifer/career-ops","slug":"glints-invalid-url-url","errorCode":null,"errorMessage":"glints: invalid URL: ${url}","messagePattern":"glints: invalid URL: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"providers/glints.mjs","lineNumber":75,"sourceCode":"        salaryMode\n        maxAmount\n        minAmount\n        CurrencyCode\n      }\n      createdAt\n    }\n    expInfo\n    hasMore\n  }\n}`;\n\n/** @param {string} url */\nfunction assertGlintsUrl(url) {\n  let parsed;\n  try {\n    parsed = new URL(url);\n  } catch {\n    throw new Error(`glints: invalid URL: ${url}`);\n  }\n  if (parsed.protocol !== 'https:') throw new Error(`glints: URL must use HTTPS: ${url}`);\n  if (!ALLOWED_GLINTS_HOSTS.has(parsed.hostname))\n    throw new Error(`glints: untrusted hostname \"${parsed.hostname}\" — must be one of: ${[...ALLOWED_GLINTS_HOSTS].join(', ')}`);\n  return url;\n}\n\n// NaN-safe Date.parse\nfunction toEpochMs(value) {\n  if (!value) return undefined;\n  const parsed = Date.parse(value);\n  return Number.isNaN(parsed) ? undefined : parsed;\n}\n\n/**\n * Derive the job detail base URL from the API hostname.\n * @param {string} apiUrl\n * @returns {string}","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/santifer/career-ops/blob/aac998c7ed7248ea853b720ceeb1fdbeb322fc5d/providers/glints.mjs#L57-L93","documentation":"assertGlintsUrl validates URLs for the Glints provider. When the input string cannot be parsed by new URL() (missing scheme, malformed characters, etc.), it throws this error — the first gate before the HTTPS and hostname-allowlist checks. ALLOWED_GLINTS_HOSTS covers glints.com, www.glints.com, and glints.id.","triggerScenarios":"A glints portal entry (e.g. a custom api endpoint URL) contains a string that is not a valid absolute URL — 'glints.com/api/v2-alc/graphql' without scheme, a URL with spaces, or an unsubstituted placeholder — and is passed to assertGlintsUrl.","commonSituations":"Hand-editing portals.yml and dropping https://; YAML multi-line folding corrupting the URL; environment-variable placeholders (${GLINTS_API}) left unresolved in the config value.","solutions":["Make the value a full absolute URL with scheme, e.g. https://glints.com/api/v2-alc/graphql","Trim whitespace/smart quotes and quote the value in YAML; resolve any ${...} placeholders before runtime","Sanity-check with `new URL(value)` locally before putting it in config","Remove a custom api value if you meant to use the default endpoint (https://glints.com/api/v2-alc/graphql)"],"exampleFix":"// before\napi: glints.com/api/v2-alc/graphql\n// after\napi: https://glints.com/api/v2-alc/graphql","handlingStrategy":"validation","validationCode":"function isValidAbsoluteUrl(s) { try { new URL(s); return true; } catch { return false; } }\nif (entry.api && !isValidAbsoluteUrl(entry.api)) throw new Error(`glints entry ${entry.name}: api is not a valid absolute URL`);","typeGuard":"function isParseableUrl(v) { return typeof v === 'string' && (() => { try { new URL(v); return true; } catch { return false; } })(); }","tryCatchPattern":"try {\n  assertGlintsUrl(url);\n} catch (e) {\n  if (String(e.message).includes('invalid URL')) {\n    console.error(`${url} is not parseable — missing https:// scheme or malformed characters`);\n    return null;\n  }\n  throw e;\n}","preventionTips":["Always include the https:// scheme in the glints api value (or omit it to use the default)","Resolve env placeholders before the scanner reads config","Quote URL strings in YAML and keep them on one line"],"tags":["url-validation","config","glints","invalid-url"],"backgroundTag":"invalid-url-format","analyzedSha":"aac998c7ed7248ea853b720ceeb1fdbeb322fc5d","analyzedAt":"2026-09-16T06:35:29.214Z","contentChangedAt":"2026-09-16T06:35:29.214Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}