Fix sampler.mjs githubPath

PR https://codeberg.org/uzu/strudel/pulls/1679 introduced a subtle bug when both other and subpath are empty. The url should not end with '//'
This commit is contained in:
jeromew 2025-10-22 21:39:08 +02:00
parent ac37b6a029
commit f0bd5bffaa

View file

@ -129,9 +129,10 @@ function githubPath(base, subpath = '') {
let repo = components.length >= 2 ? components[1] : 'samples';
let branch = components.length >= 3 ? components[2] : 'main';
let other = components.slice(3);
other.push(subpath ? subpath : '')
other = other.join('/');
return `https://raw.githubusercontent.com/${user}/${repo}/${branch}/${other}/${subpath}`;
return `https://raw.githubusercontent.com/${user}/${repo}/${branch}/${other}`;
}
export const processSampleMap = (sampleMap, fn, baseUrl = sampleMap._base || '') => {