Tone.js icon indicating copy to clipboard operation
Tone.js copied to clipboard

URL parsing broken for certain foreign characters

Open JeffreyCA opened this issue 3 years ago • 0 comments

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/[email protected]";
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/[email protected]";
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

JeffreyCA avatar Feb 20 '22 07:02 JeffreyCA