fix: force-clear template data for HTML files to show iframe
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -254,6 +254,16 @@ func prepareFileView(ctx *context.Context, entry *git.TreeEntry) {
|
||||
case fInfo.blobOrLfsSize >= setting.UI.MaxDisplayFileSize:
|
||||
ctx.Data["IsFileTooLarge"] = true
|
||||
case handleFileViewRenderHTML(ctx, fInfo):
|
||||
// ALL debug logs and template data are correct, but the template renders source.
|
||||
// FORCE iframe rendering: override FileContent so template skips source view.
|
||||
ctx.Data["IsImageFile"] = false
|
||||
ctx.Data["IsVideoFile"] = false
|
||||
ctx.Data["IsAudioFile"] = false
|
||||
// Clear any FileContent that might have leaked
|
||||
delete(ctx.Data, "FileContent")
|
||||
delete(ctx.Data, "RenderAsMarkup")
|
||||
delete(ctx.Data, "IsPlainText")
|
||||
delete(ctx.Data, "IsDisplayingSource")
|
||||
case handleFileViewRenderMarkup(ctx, buf, contentReader):
|
||||
case handleFileViewRenderSource(ctx, attrs, fInfo, contentReader):
|
||||
// it also sets ctx.Data["FileContent"] and more
|
||||
|
||||
Reference in New Issue
Block a user