React's sanitizer has refused these fonts

I've encountered font issues on my page while using react. Previously, everything was working fine but now I'm seeing the following error in the console.

Attempted solutions like running npm audit --force (something along those lines).

Additionally, the images I added through CSS are not displaying properly.

Error: downloadable font: rejected by sanitizer (font-family: "Satoshi-Bold" style:normal weight:700 stretch:100 src index:2) source: http://localhost:3000/public/fonts/Satoshi-Bold.ttf downloadable font: rejected by sanitizer (font-family: "Satoshi-Medium" style:normal weight:500 stretch:100 src index:2) source: http://localhost:3000/public/fonts/Satoshi-Medium.ttf

The font code I am using in the CSS is as follows:

@font-face {
    font-family: 'Satoshi-Medium';
    src: url('/public/fonts/Satoshi-Medium.woff2') format('woff2'), url('/public/fonts/Satoshi-Medium.woff') format('woff'), url('/public/fonts/Satoshi-Medium.ttf') format('truetype');
    font-weight: 500;
    font-display: swap;
    font-style: normal;
}

@font-face {
    font-family: 'Satoshi-Bold';
    src: url('/public/fonts/Satoshi-Bold.woff2') format('woff2'), url('/public/fonts/Satoshi-Bold.woff') format('woff'), url('/public/fonts/Satoshi-Bold.ttf') format('truetype');
    font-weight: 700;
    font-display: swap;
    font-style: normal;
}

If you have any ideas on how to resolve this issue, please share. Thanks!

Answer №1

I encountered similar issues with loading Google fonts, but found a solution by replacing @font-face with @import:

@import url('https://fonts.googleapis.com/css2?family=Jost&display=swap');

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Excessive Expansion of Website Width

Initially, I crafted a website on my local server, and it had the ideal width. Afterwards, I uploaded it to the live server and made some design modifications. To my surprise, there is now an unexpected scroll bar at the bottom of the page, causing the s ...

Inserting pictures onto Bootstrap SVGs

Currently working on a website using Bootstrap 5 and incorporating an element from BS5 templates: <div class="col" data-aos="fade-up" data-aos-delay="200"> <div class="card shadow-sm"> ...

Generating an HTML table from information stored in a text file

As a beginner in web design, I am looking to create an HTML table using data from a text file. I'm unsure of the best approach to take, so any guidance or pointers would be greatly appreciated. ...

Handling image errors in jQuery for responsive design queries

Images on my website change based on the screen size using media queries. I am looking for a way to handle errors that may occur using jQuery. I want to display a text message if the image fails to load. Here is the code I have so far: <div class="con ...

Is there a way to modify the parent component's state and pass it down to the child component as a prop efficiently?

I am facing an issue with a parent component that sets the score counter and passes it to the child component. There is a function in the parent component called resetBoard() which should reset the score counter back to 0 when triggered by a button click ...

Troubleshooting: Issues with Jquery's replaceWith function

I'm facing an issue with a table I have that includes a button in one of its columns. The button is supposed to toggle the class of the current row in the table and then replace itself once clicked. $(document).ready(function() { $(".checkOut"). ...

How can we efficiently render multiple components whose parent components are wrapped in multiple elements in React Router v6?

Currently, I am developing a Project with multiple components in the "/" directory. To manage this, I have wrapped them into a Route with Fragment. Within these child components, there is a parent-child relationship that needs to be defined within the Rout ...

The Gatsby Image using Netlify CMSField should not include a selection as the type "String" does not have any subfields

Today, I encountered a puzzling issue that has left me stumped. As someone relatively new to React and Gatsby, I've been working on a Website powered by Netlify CMS. Everything was running smoothly in the past few days until today when something stran ...

Problem with input field borders in Firefox when displayed within table cells

Demo When clicking on any cell in the table within the JSFiddle using Firefox, you may notice that the bottom and right borders are hidden. Is there a clever solution to overcome this issue? I have experimented with a few approaches but none of them work ...

How to successfully incorporate Google fonts into an HTML email for Outlook

Hey everyone – I've come across multiple websites discussing this issue, but I'm still struggling to get it right. I'm trying to incorporate a Google font (specifically, Fira Sans) into an HTML email so that it shows up correctly in Outloo ...

Utilize the Material UI feature to call the function

How can I pass a function as a prop to my Material UI component if the function is undefined within the component? import React, { Component } from 'react'; import styled from 'styled-components'; import InputBase from '@material- ...

Adjusting the border size of an SVG without using the viewbox

Currently, I am working with 2 SVGs where one has a viewbox and the other doesn't. They both are set to be 100% width of the parent element. The first SVG scales according to its viewbox while the second one scales according to the height of the paren ...

Strategies for avoiding overflow-x issues in Safari and mobile devices

I am currently facing an issue where I have a div containing a table with overflow enabled, allowing the whole table to be viewed by scrolling. However, on Safari and mobile Safari browsers, there is a horizontal scroll on the html and body elements. Whil ...

Align the video element to the top left corner using Bootstrap 4

Just getting started with bootstrap and css. I'm trying to insert a video element into a row class and want it to be positioned at the top left of the row without any margins. Currently, the video is centered vertically with space above it. Ideally, ...

Tips for avoiding overflow while utilizing animations

In my current project, I am facing an issue with a container div that has the CSS property overflow: auto which cannot be removed. Inside this container, there is another div that toggles between showing and hiding using an animation triggered by a button ...

Looking for a search box that functions like Google's search feature

I am attempting to create a text box similar to the Google search text box... So far, I have implemented a feature where, upon entering a character, words starting with that character are displayed in a div using AJAX. This functionality is working well, ...

Utilizing the '::marker' pseudo-element for generating Markdown-inspired headers

This code snippet is functioning correctly, however, I have a suggestion to make it more appropriate. Instead of using '::before', why not try using '::marker'? I attempted this adjustment but encountered an issue. Can anyone explain wh ...

How can I transform an HTML div into a video file like MP4 using Python and Django?

I'm looking to take a HTML page and target a specific <div> within it in order to convert it into video format. Purpose: I understand that HTML is typically static, but I have a requirement to transform it into a video. I'm seeking method ...

Exploring NextJS: Implementing Routing for Multilingual Support

I am currently working on developing a multilanguage website using Next JS. For the translation functionality, I have integrated the next-translate package into my project. When it comes to generating posts, I have opted for static generation as my appro ...

Display a React Material-UI Button variant depending on the isActive state of a NavLink using TypeScript with Material-UI and React Router v

I'm attempting to dynamically change the variant of a mui Button based on the isActive state of a Navlink, but I'm running into an error <Button to="/" component={NavLink} variant={({isActive}:{isActive:any}) => isActive ? 'contained&a ...