Tonejs / Tone.js

A Web Audio framework for making interactive music in the browser.
https://tonejs.github.io
MIT License
13.51k stars 983 forks source link

URL parsing broken for certain foreign characters #1039

Closed JeffreyCA closed 4 months ago

JeffreyCA commented 2 years ago

Describe the bug

There was a regression introduced between 14.8.26 and 14.8.37 where initializing a Player by URL fetches the wrong URL if it contains special characters.

To Reproduce Check the browser console to see the URL it tries to load.

Expected - 14.8.26 (Codepen):

import * as Tone from "https://cdn.skypack.dev/tone@14.8.26";
const players = new Tone.Players(
      {
        a: '允.mp3'
      },
      () => {
      }
);

https://cdpn.io/JeffreyCA/fullpage/%E5%85%81.mp3

Broken - 14.8.37 (Codepen):

import * as Tone from "https://cdn.skypack.dev/tone@14.8.37";
const players = new Tone.Players(
      {
        a: '允.mp3'
      },
      () => {
      }
);

https://cdpn.io/JeffreyCA/fullpage/%25E5%2585%2581.mp3

Additional context

Related: https://github.com/Tonejs/Tone.js/pull/971, https://github.com/Tonejs/Tone.js/pull/902