diff --git a/copyparty/web/util.js b/copyparty/web/util.js
index 09497aec..bdb022bc 100644
--- a/copyparty/web/util.js
+++ b/copyparty/web/util.js
@@ -1664,16 +1664,17 @@ function md_thumbs(md) {
continue;
}
- var t = md[a].split(/\]\(/, 2),
- t2 = t[1].split(/\)/, 2),
- url = t2[0],
- flags = t[0].split(/,/g),
+ var o1 = md[a].indexOf(']('),
+ o2 = md[a].indexOf(')', o1),
+ alt = md[a].slice(0, o1),
+ flags = alt.split(','),
+ url = md[a].slice(o1 + 2, o2),
float = has(flags, 'l') ? 'left' : has(flags, 'r') ? 'right' : '';
if (!/[?&]cache/.exec(url))
url += (url.indexOf('?') < 0 ? '?' : '&') + 'cache=i';
- md[a] = '
' + t2[1];
+ md[a] = '
' + md[a].slice(o2 + 1);
}
return md.join('');
}