This commit is contained in:
Logan
2026-04-12 22:07:54 -04:00
parent 357553f1ea
commit b29dcc1518
+4 -3
View File
@@ -71,14 +71,15 @@ async def upload_call_audio(
def _public_url_to_gcs_uri(url: str) -> Optional[str]:
"""
Convert a public GCS URL like
https://storage.googleapis.com/bucket/calls/file.mp3
Convert a public GCS URL (possibly signed) like
https://storage.googleapis.com/bucket/calls/file.mp3?Expires=...
to a gs:// URI usable by Speech-to-Text.
Returns None if the URL doesn't look like a GCS URL.
"""
prefix = "https://storage.googleapis.com/"
if url and url.startswith(prefix):
return "gs://" + url[len(prefix):]
path = url[len(prefix):].split("?")[0] # strip signed-URL query params
return "gs://" + path
return None