Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

chore: fix experimental blob errors in preview non-exist files #1479

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions 18 bigframes/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -778,15 +778,15 @@ def _repr_html_(self) -> str:

def obj_ref_rt_to_html(obj_ref_rt) -> str:
obj_ref_rt_json = json.loads(obj_ref_rt)
gcs_metadata = obj_ref_rt_json["objectref"]["details"][
"gcs_metadata"
]
content_type = typing.cast(
str, gcs_metadata.get("content_type", "")
)
if content_type.startswith("image"):
url = obj_ref_rt_json["access_urls"]["read_url"]
return f'<img src="{url}">'
obj_ref_details = obj_ref_rt_json["objectref"]["details"]
if "gcs_metadata" in obj_ref_details:
gcs_metadata = obj_ref_details["gcs_metadata"]
content_type = typing.cast(
str, gcs_metadata.get("content_type", "")
)
if content_type.startswith("image"):
url = obj_ref_rt_json["access_urls"]["read_url"]
return f'<img src="{url}">'

return f'uri: {obj_ref_rt_json["objectref"]["uri"]}, authorizer: {obj_ref_rt_json["objectref"]["authorizer"]}'

Expand Down
12 changes: 10 additions & 2 deletions 12 bigframes/operations/blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from typing import cast, Optional, Union

import IPython.display as ipy_display
import pandas as pd
import requests

from bigframes import clients
Expand Down Expand Up @@ -209,8 +210,15 @@ def display(self, n: int = 3, *, content_type: str = ""):
else:
df["content_type"] = df["blob_col"].blob.content_type()

def display_single_url(read_url: str, content_type: str):
content_type = content_type.casefold()
def display_single_url(
read_url: str, content_type: Union[str, pd._libs.missing.NAType]
):
if content_type is pd.NA: # display as raw data or error
response = requests.get(read_url)
ipy_display.display(response.content)
return

content_type = cast(str, content_type).casefold()

if content_type.startswith("image"):
ipy_display.display(ipy_display.Image(url=read_url))
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.