昨晚,在做一个自己感兴趣的东西时,发现浏览器报警告,Failed to decode downloaded font以及OTS parsing error: Failed to convert *** font to ***。

但是这个问题从来没有遇到过,在网上找了一会儿答案后,发现了类似的问题回答下有网友猜测是拦截器没通过,所以我检查了shiro的拦截配置:

<property name="filterChainDefinitions">
<value>
/=authc
/index=authc
/logout=logout
/assets/** = anon
/css/** = anon
/fonts/**=anon
/img/**=anon
/**= user
</value>
</property>

但是这个配置理论上是没问题的,所以不是这个问题。

今天在查阅了一些资料后,发现了可能的原因:

在maven的filter解析font文件时,它破坏了font文件的二进制文件格式,导致浏览器解析出错。

解决的思路是:font文件不需要filter,因此我们需要在配置中设置一下(SpringBoot在pom.xml中写入):

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
<resources>
<!-- fonts file cannot use filter as the data structure of byte file will be changed via filter -->
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>static/fonts/**</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<includes>
<include>static/fonts/**</include>
</includes>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</build>

在经如上所示的配置后,maven在编译项目时不解析font文件,浏览器就不会报警告,字体也可以正常显示。

浏览器警告Failed to decode downloaded font和OTS parsing error: Failed to convert *** font to ***的更多相关文章

  1. Spring Boot + Bootstrap 出现"Failed to decode downloaded font"和"OTS parsing error: Failed to convert WOFF 2.0 font to SFNT"

    准确来讲,应该是maven项目使用Bootstrap时,出现 "Failed to decode downloaded font"和"OTS parsing error: ...

  2. Spring Boot - Font Awesome OTS parsing error: Failed to convert 字体加载失败

    字体文件,加载不出来 解决方案  一 问题是Maven正在过滤字体文件并破坏它们. <resource> <directory>${project.basedir}/src/m ...

  3. 处理springboot OTS parsing error: Failed to convert WOFF 2.0 font to SFNT

    springboot项目中添加了字体等文件后,页面无法识别,浏览器调试窗口报错如下: Failed to decode downloaded font: http://localhost:8080/f ...

  4. 解决Spring Boot OTS parsing error: Failed to convert WOFF 2.0

    <build> <resources> <resource> <directory>${project.basedir}/src/main/resour ...

  5. chrome浏览器警告:Failed to decode downloaded font:

    使用iconfont字体时chrome报错 Failed to decode downloaded font: 在服务器设置一下自己定义MIME类型. 扩展名: .woff Mime类型:applic ...

  6. Failed to decode downloaded font

    碰到如下错误,该错误是开启layui的打印.导出.筛选列时出现的,不能正常显示图标及文字 原因: @参考文章 因为经过maven的filter,会破坏font文件的二进制文件格式,到时前台解析出错 解 ...

  7. 记一次elementUI Icon 加载无效的问题。并且提示错误 Failed to decode downloaded font:

    问题在于webpack的loader中.检查了一下发现有两个相同的file-loader的配置,删除其中一个即可.

  8. URIError: Failed to decode param '/%PUBLIC_URL%/favicon.ico'

    今天搭建antd的项目结构,本来项目是一个基础react项目,结果执行 yarn create umi yarn yarn start 项目启动后访问突然报错URIError: Failed to d ...

  9. composer 报错:Failed to decode response: zlib_decode(): data error 解决办法

    执行命令 composer require particle/validator 报错 Failed to decode response: zlib_decode(): data error 网上推 ...

随机推荐

  1. linux进程延迟

    #include <linux/wait.h> long wait_event_interruptible_timeout(wait_queue_head_t *q, condition, ...

  2. Linux下tomcat启动成功但是Windows打不开tomcat网址

    前提条件: 1.Linux和Windows都可以相互ping通. 2.Linux下tomcat可以启动,并且在Linux下可以访问8080 出现的问题: 当我在Windows下访问时,无法连接或者出现 ...

  3. Linux 内核 动态设备

    术语"热插拔"最普遍使用的意义产生于当讨论这样的事实时, 几乎所有的计算机系统现在 能够处理当系统有电时设备的出现或消失. 这非常不同于只是几年前的计算机系统, 那时 程序员知道他 ...

  4. Vue的数据双向绑定和Object.defineProperty()

    Vue是前端三大框架之一,也被很多人指责抄袭,说他的两个核心功能,一个数据双向绑定,一个组件化分别抄袭angular的数据双向绑定和react的组件化思想,咱们今天就不谈这种大是大非,当然我也没到达那 ...

  5. 将 using namespace 写在函数体中,以避免命名空间冲突

    将 using namespace xxx 写在函数体中时, 命名空间 xxx 中定义的资源只在该函数体中有效. 测试代码如下图所示(namespace std 只在函数 testFun2 中有效):

  6. Android 最新架构

    1.Android系统架构 最新的Android系统分为五层六区(域): Linux内核层(Linux Kernel):Android系统基于Linux2.6内核,这一层为Android设备各种硬件提 ...

  7. Jmeter官方插件安装

    在正常使用的过程中,当jmeter功能满足不了使用场景时,可以通过安装官方的插件去实现. Jmeter插件管理官网地址: https://jmeter-plugins.org/install/Inst ...

  8. jsqlparser和calcite和druid功能对比

    需求分析:(用其它方法替代metabase中的某些功能)功能1.通过对sql查询语句的分析,得到所有表名,以及所有表的字段名,字段类型,字段注解信息.功能2.在sql语句执行查询前,校验sql语句是否 ...

  9. SQL Server 中数据查询注意事项

    1.查询语句不用区分大小写,而且即使每张表的表名或者列名出现大写字母,在写查询语句的时候也不用区分大小写,查询结果保持一致,所以查询语句小写即可. 2.在写查询语句的时候列名不需要带单引号,数值型的字 ...

  10. 记一次买4K显示器的心酸历程

    由于最近在 B 站直播的次数有点多,还有就是平时录制的视频也有点人看了,所以想多做点视频发布到 B 站上面,但是自己看了以前的视频,发现视频确实画面确实粗糙,不仅仅是视频不清晰的原因,更主要的是我眼睛 ...