You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c614ca5
Browse filesBrowse the repository at this point in the historyBrowse files
fix(visualization): agree on a string image, and escape the cell URL Viz writes
Image Visualizer read any string as ready base64, where the executor hands the
same value to b64encode and shows its reason page when the value is not bytes.
The exported script reads a BINARY column as the base64 text JSONL carries, so
the text is the image only where the column was declared BINARY; a column of
any other type now fails in the same call, on the same page.
URL Visualizer wrote the cell straight into the iframe's src attribute, so a
quote in it closed the attribute and left the rest of the cell standing as
attributes of the iframe. Both paths escape it now, the same five characters
in the same order, which is what html.escape(quote=True) writes. An ampersand
in a URL is written & from here on, which the browser reads back as one.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copy file name to clipboardExpand all lines: common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/visualization/ImageViz/ImageVisualizerOpDesc.scala
+19-2Lines changed: 19 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -105,15 +105,32 @@ class ImageVisualizerOpDesc extends PythonOperatorDescriptor with StandaloneCode
105
105
// The translator skips it in the leaf-DataFrame print block.
Copy file name to clipboardExpand all lines: common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/visualization/urlviz/UrlVizOpDesc.scala
+10-3Lines changed: 10 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -89,16 +89,23 @@ class UrlVizOpDesc extends LogicalOp with StandaloneCodeGenerator {
89
89
// iframe HTML document and emit it as the "html-content" column.
90
90
overridedefgenerateStandaloneCode():String= {
91
91
valurlLit= pyStringLiteral(urlContentAttrName)
92
-
s"""def _texera_urlviz_iframe(u):
92
+
s"""import html
93
+
|
94
+
|def _texera_urlviz_iframe(u):
93
95
| # "null", not Python's "None": the operator interpolates the field into a
94
96
| # Scala string, and the JVM renders a null that way.
95
-
| u = "null" if pd.isna(u) else u
97
+
| u = "null" if pd.isna(u) else str(u)
98
+
| # The cell lands where an attribute is expected, so a quote in it would
99
+
| # close src= and leave the rest of the cell standing as attributes of the
100
+
| # iframe. escapeAttribute on the executor writes the same five characters
101
+
| # in the same order, so the two paths write the page the same way.
Copy file name to clipboardExpand all lines: common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/visualization/urlviz/UrlVizOpExec.scala
Copy file name to clipboardExpand all lines: common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/ImageViz/ImageVisualizerOpDescSpec.scala
Copy file name to clipboardExpand all lines: common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/urlviz/UrlVizOpDescSpec.scala
page should include("""src="https://example.invalid/a" onload="alert(1)"""")
164
+
page should not include """onload="alert"""
165
+
}
166
+
167
+
it should "write that cell the same way in the exported script" in {
0 commit comments