Personal Telegram developer console for GitHub

fix: render repository file names with safe DOM APIs

davoodmehraban89 committed Oct 24, 2026 at 17:23 UTC b264bdf242d4860a2fbc95c4c644c181836abeab
1 file changed +8 -1
src/workspace-editor.js
+8 -1
@@ -177,7 +177,14 @@ export function renderWorkspaceEditorPage() {
177 const selectedPath = params.get('path') || '';
178 const body = await api('/workspace/api/editor?workspaceId=' + encodeURIComponent(workspaceId) + (selectedPath ? '&path=' + encodeURIComponent(selectedPath) : ''));
179 limits = body.limits || limits;
180 - files.innerHTML = (body.workspace.files || [{path:body.workspace.path}]).map(file => '<option value="' + file.path.replaceAll('&','&amp;').replaceAll('"','&quot;') + '">' + file.path.replaceAll('&','&amp;').replaceAll('<','&lt;') + '</option>').join('');
180 + // Never interpolate repository-controlled paths into HTML.
181 + files.replaceChildren();
182 + for (const file of (body.workspace.files || [{path:body.workspace.path}])) {
183 + const option = document.createElement('option');
184 + option.value = file.path;
185 + option.textContent = file.path;
186 + files.appendChild(option);
187 + }
188 files.value = body.workspace.path; files.disabled = false;
189 path.textContent = body.workspace.path;
190 editor.value = body.workspace.draftText || '';