File tree 1 file changed +10
-2
lines changed
pkg/server/routes/web/static/js
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change
1
+ // Utility function to encode text content
2
+ function encodeTextContent ( text ) {
3
+ const div = document . createElement ( 'div' ) ;
4
+ div . appendChild ( document . createTextNode ( text ) ) ;
5
+ return div . innerHTML ;
6
+ }
7
+
1
8
// Append inputs to form create job
2
9
document . getElementById ( 'add-provider-select' ) . addEventListener ( 'change' , async ( e ) => {
3
10
try {
@@ -21,8 +28,9 @@ document.getElementById('add-provider-select').addEventListener('change', async
21
28
document . querySelector ( 'table tbody' ) . addEventListener ( 'click' , function ( event ) {
22
29
const row = event . target . closest ( 'tr' ) ;
23
30
if ( ! row ) return ;
24
- document . getElementById ( 'edit-id' ) . value = row . querySelector ( 'td:nth-child(1)' ) . textContent ;
25
- document . getElementById ( 'delete-button' ) . href = `/api/job/delete?ID=${ row . querySelector ( 'td:nth-child(1)' ) . textContent } ` ;
31
+ const idText = row . querySelector ( 'td:nth-child(1)' ) . textContent ;
32
+ document . getElementById ( 'edit-id' ) . value = idText ;
33
+ document . getElementById ( 'delete-button' ) . href = `/api/job/delete?ID=${ encodeTextContent ( idText ) } ` ;
26
34
document . getElementById ( 'edit-provider-select' ) . value = row . querySelector ( 'td:nth-child(2)' ) . textContent ;
27
35
const params = JSON . parse ( row . querySelector ( 'td:nth-child(4)' ) . getAttribute ( 'json' ) ) ;
28
36
let html = '' ;
You can’t perform that action at this time.
0 commit comments