fastapi-debug-toolbar icon indicating copy to clipboard operation
fastapi-debug-toolbar copied to clipboard

Versions panel failure occurs if there are any installed editable modules.

Open enginaygen opened this issue 1 year ago • 0 comments

The versions page does not load, and the following error appears in the console. 'purepower' is an editable module in my environment, so the script can't find it on pypi.org and fails to load the page.

pypi.org/pypi/purepower/json:1 Failed to load resource: the server responded with a status of 404 ()

It can be fixed by changing the updateRow function in versions.js as follows:

  if (data === null || !(rowVersion.textContent in data.releases)) {
    fetch(`https://pypi.org/pypi/${name}/json`).then(function (response) {
      if (response.ok) {
        response.json().then(function (pypi) {
          const data = getData(pypi);

          if (!(rowVersion.textContent in data.releases)) {
            data.releases[rowVersion.textContent] = null;
          }
          localStorage.setItem(`pypi-${name}`, JSON.stringify(data));
          render(rowVersion, data);
          resolve();
        });
      }
      else {
        resolve();
      }
    });
  } else {
    render(rowVersion, data);
    resolve();
  }
});

}

enginaygen avatar Sep 19 '24 22:09 enginaygen