fix(knative): clean up blob URL and DOM node after log download - #1223
Open
magic-peach wants to merge 1 commit into
Open
fix(knative): clean up blob URL and DOM node after log download#1223magic-peach wants to merge 1 commit into
magic-peach wants to merge 1 commit into
Conversation
downloadPlainLogs creates an anchor element and an object URL for every download but never removes either. kompose's download button and ai-assistant's LogsDialog both already revoke the URL and remove the element right after triggering the click (LogsDialog does it in a finally so it still happens if click() throws) - this one didn't, so each download left a detached anchor in the DOM and pinned the blob in memory for the rest of the session. Same pattern as those two now. Signed-off-by: Akanksha Trehun <akankshatrehun@gmail.com>
magic-peach
requested review from
ashu8912,
illume,
joaquimrocha,
skoeva,
sniok,
vyncent-t and
yolossn
as code owners
August 19, 2026 15:00
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Downloading logs from the KService log viewer creates a Blob URL and an anchor element for every click, but never revokes the URL or removes the element afterward. Each download leaves a detached
<a>in the DOM permanently and pins the log Blob in memory for the rest of the session — noticeable on a page where someone re-downloads logs repeatedly while debugging.Both
kompose's download button andai-assistant'sLogsDialogalready do this correctly in this same repo (the latter uses a try/finally so cleanup happens even ifclick()throws), so I matched that pattern here instead of inventing a new one.Verified the before/after behavior with a standalone script simulating both code paths — the old one never calls
remove()/revokeObjectURL, the new one calls both every time regardless of whetherclick()succeeds. Didn't add a full component-render test since exercising this function means standing up the whole KService pods/activity/permissions mocking chain for a five-line cleanup fix, which felt disproportionate — happy to add one if a maintainer wants it.