Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/type/p5.Font.js
Original file line number Diff line number Diff line change
Expand Up @@ -1480,7 +1480,15 @@ function font(p5, fn) {
let isCSS = path.includes('@font-face');

if (!isCSS) {
const info = await fetch(path, { method: 'HEAD' });
let info;
try {
info = await fetch(path, { method: 'HEAD' });
} catch (e) {
// Sometimes files fail when requested with HEAD. Fallback to a
// regular GET. It loads more data, but at least then it's cached
// for the likely case when we have to fetch the whole thing.
info = await fetch(path);
}
const isCSSFile = info.headers.get('content-type')?.startsWith('text/css');
if (isCSSFile) {
isCSS = true;
Expand Down
Loading