Skip to content

Conversation

@khanhlvg
Copy link
Contributor

Fix for 'Could not open the data' error on link-style-button click

image image

Problem

We see an error message: "Could not open the data. It might be invalid or too large. Check the browser console for errors." when clicking artifact links in the chat UI.

Root Cause

The openBase64InNewTab function, which was responsible for opening base64 encoded data in a new tab, was being assigned directly from this.safeValuesService.openBase64InNewTab to a property in src/app/components/chat/chat.component.ts. When this property was invoked from the template, the this context within the openBase64InNewTab function (defined in SafeValuesService) was lost. Consequently, internal calls like this.openBlobUrl(blob) failed because this no longer referred to the SafeValuesService instance, leading to the reported error.

Fix

src/app/components/chat/chat.component.ts: The property assignment protected openBase64InNewTab = this.safeValuesService.openBase64InNewTab; was replaced with a proper method:
typescript protected openBase64InNewTab(dataUrl: string, mimeType: string) { this.safeValuesService.openBase64InNewTab(dataUrl, mimeType); }
This ensures that when openBase64InNewTab is called from the template, it correctly invokes the safeValuesService method with the proper this context.

@copybara-service copybara-service bot merged commit 7b4cebd into google:main Nov 24, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants