fix: validate Ollama URL protocol before fetching api/tags

This commit is contained in:
2026-04-01 20:51:23 +02:00
parent 0bdc0a5e42
commit 52ba53bec4
+3 -1
View File
@@ -36,7 +36,9 @@ async function loadDevices() {
async function loadOllamaModels(baseUrl, current) { async function loadOllamaModels(baseUrl, current) {
try { try {
const r = await fetch(baseUrl + '/api/tags'); const parsed = new URL(baseUrl);
if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') return;
const r = await fetch(parsed.origin + '/api/tags');
if (!r.ok) return; if (!r.ok) return;
const data = await r.json(); const data = await r.json();
const sel = document.getElementById('ollama-model'); const sel = document.getElementById('ollama-model');