chore: Reduces the form_data_key length (#31905)

This commit is contained in:
Michael S. Molina
2025-01-21 16:49:10 -03:00
committed by GitHub
parent dca3efb3dd
commit a02a2f5a96
2 changed files with 10 additions and 3 deletions

View File

@@ -31,8 +31,14 @@ from superset.utils.json import json_dumps_w_dates
HASHIDS_MIN_LENGTH = 11
def random_key() -> str:
return token_urlsafe(48)
def random_key(nbytes: int = 8) -> str:
"""
Generate a random URL-safe string.
Args:
nbytes (int): Number of bytes to use for generating the key. Default is 8.
"""
return token_urlsafe(nbytes)
def get_filter(resource: KeyValueResource, key: Key) -> KeyValueFilter: