Description
p5.js version
No response
What is your operating system?
None
Web browser and version
No response
Actual Behavior
This one is not easily reproducible because the 404 pages choose a sketch at random, so I can't link to a particular URL where it happens. However I noticed it on a 404 page which attempted to render this sketch: https://editor.p5js.org/p5/sketches/Advanced_Data:_Load_Saved_Table
This sketch loads a .csv
file:
function preload() {
table = loadTable("assets/bubbles.csv", "header");
}
The /server/views/404Page.js
file re-writes that path:
p5.js-web-editor/server/views/404Page.js
Lines 123 to 131 in 1c05241
And we get a URL https://rawgit.com/processing/p5.js-website/main/dist/assets/examples/assets//bubbles.csv which does not exist. The rawgit.com service has actually been deprecated since 2018 and it should not be used. But it does still work if we use the correct URL, which is https://rawgit.com/processing/p5.js-website/main/src/data/examples/assets/bubbles.csv as the file is located at https://github.com/processing/p5.js-website/blob/main/src/data/examples/assets/bubbles.csv. The fatal problem is that we are creating improper paths.
Expected Behavior
When the sketch is run by the previewServer
, the output code is:
function preload() {
table = loadTable("https://cdn.jsdelivr.net/gh/processing/p5.js-website@main/src/data/examples/assets/bubbles.csv", "header");
}
This works, and it matches what is included in the .files
property of the sketch object:
{
"name": "bubbles.csv",
"content": "",
"children": [],
"fileType": "file",
"_id": "6459341065978bfc7dc6c7b4",
"url": "https://cdn.jsdelivr.net/gh/processing/p5.js-website@main/src/data/examples/assets/bubbles.csv",
"createdAt": "2023-05-08T17:40:32.645Z",
"updatedAt": "2023-05-08T17:40:32.645Z",
"id": "6459341065978bfc7dc6c7b4"
}
Steps to reproduce
It happens at random on any 404 URL, depending on which sketch is chosen.