fix
This commit is contained in:
@@ -71,14 +71,15 @@ async def upload_call_audio(
|
|||||||
|
|
||||||
def _public_url_to_gcs_uri(url: str) -> Optional[str]:
|
def _public_url_to_gcs_uri(url: str) -> Optional[str]:
|
||||||
"""
|
"""
|
||||||
Convert a public GCS URL like
|
Convert a public GCS URL (possibly signed) like
|
||||||
https://storage.googleapis.com/bucket/calls/file.mp3
|
https://storage.googleapis.com/bucket/calls/file.mp3?Expires=...
|
||||||
to a gs:// URI usable by Speech-to-Text.
|
to a gs:// URI usable by Speech-to-Text.
|
||||||
Returns None if the URL doesn't look like a GCS URL.
|
Returns None if the URL doesn't look like a GCS URL.
|
||||||
"""
|
"""
|
||||||
prefix = "https://storage.googleapis.com/"
|
prefix = "https://storage.googleapis.com/"
|
||||||
if url and url.startswith(prefix):
|
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
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user