mirror of
https://github.com/stablyai/orca.git
synced 2026-09-24 00:02:24 +00:00
Fix paste ownership, input bounds, and IPC validation
Supersedes #5745, #5746, and #5747.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { getClipboardTextByteLength, isClipboardTextByteLengthOverLimit } from './clipboard-text'
|
||||
|
||||
export const GITHUB_PROJECT_REF_INPUT_MAX_BYTES = 2 * 1024
|
||||
export const GITHUB_PROJECT_REF_INPUT_TOO_LARGE_ERROR = 'Project reference is too large to resolve.'
|
||||
|
||||
export function getGitHubProjectRefInputByteLength(input: string): number {
|
||||
return getClipboardTextByteLength(input)
|
||||
}
|
||||
|
||||
export function isGitHubProjectRefInputTooLarge(
|
||||
input: string,
|
||||
maxBytes = GITHUB_PROJECT_REF_INPUT_MAX_BYTES
|
||||
): boolean {
|
||||
return isClipboardTextByteLengthOverLimit(input, maxBytes)
|
||||
}
|
||||
|
||||
export function hasBoundedGitHubProjectRefInputText(input: string): boolean {
|
||||
return !isGitHubProjectRefInputTooLarge(input) && /\S/.test(input)
|
||||
}
|
||||
Reference in New Issue
Block a user