In a project I work in here is a problem with binary static files (woff2 and wasm files) served with a Spring boot project from a webjar file are being corrupted, they are larger than they should be.
When the service is ran locally with mvn spring-boot:run the file size is correct and works fine, but in production the fonts and Web Assembly code cannot be used. The wasm file is 196287 bytes if I extract it from the jar file and that is exactly the same as in the development filesystem/repo. When served in production the file size of the downloaded file is 225201 and it will not compile the Web Assembly module.
I have seen several other issues related to maven corrupting files, but as the file size is correct when I extract the file possibly this is something else? We have been using maven-resources-plugin version 3.0.1 which is a bit outdated. We are trying to disabling filtering for binary types as described in https://maven.apache.org/plugins/maven-resources-plugin/examples/binaries-filtering.html .
<build>
<resources>
<resource>
<directory>build</directory>
<targetPath>META-INF/resources</targetPath>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<encoding>UTF-8</encoding>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>ttf</nonFilteredFileExtension>
<nonFilteredFileExtension>woff</nonFilteredFileExtension>
<nonFilteredFileExtension>woff2</nonFilteredFileExtension>
<nonFilteredFileExtension>eot</nonFilteredFileExtension>
<nonFilteredFileExtension>wasm</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
</plugins>
</build>
I'm thinking if Spring boot when in dev mode actually reads the mime type of a file and in production assumes everything is UTF-8 text, thereby corrupting the binary files? This should then be a common problem for may projects?
Any thoughts on how to debug this further?
Update: Attached below is the first point where the files differ (from vbindiff), it's a bit beyond my skills to read anything out of this but maybe someone else can.
pulldown_cmark_wasm_bg.wasm
0000 0190: 06 89 80 80 80 00 01 7F 01 41 80 80 C0 00 0B 07 ........ .A......
0000 01A0: D1 80 80 80 00 05 06 6D 65 6D 6F 72 79 02 00 06 .......m emory...
0000 01B0: 66 6F 72 6D 61 74 00 32 11 5F 5F 77 62 69 6E 64 format.2 .__wbind
0000 01C0: 67 65 6E 5F 6D 61 6C 6C 6F 63 00 9C 01 12 5F 5F gen_mall oc....__
0000 01D0: 77 62 69 6E 64 67 65 6E 5F 72 65 61 6C 6C 6F 63 wbindgen _realloc
0000 01E0: 00 A1 01 0F 5F 5F 77 62 69 6E 64 67 65 6E 5F 66 ....__wb indgen_f
0000 01F0: 72 65 65 00 B4 01 09 F4 80 80 80 00 01 00 41 01 ree..... ......A.
0000 0200: 0B 3E B5 01 B6 01 08 B9 01 B2 01 7B 29 B1 01 D6 .>...... ...{)...
0000 0210: 01 80 01 95 01 97 01 1F CB 01 C8 01 CD 01 26 4D ........ ......&M
0000 0220: 83 01 CC 01 BA 01 BB 01 81 01 BC 01 37 47 CE 01 ........ ....7G..
0000 0230: 92 01 D0 01 38 CF 01 AA 01 D5 01 87 01 D4 01 86 ....8... ........
0000 0240: 01 D3 01 94 01 D2 01 39 D1 01 85 01 A0 01 D7 01 .......9 ........
0000 0250: AC 01 D8 01 53 D9 01 B3 01 40 82 01 DA 01 DB 01 ....S... .@......
0000 0260: CA 01 DC 01 8B 01 DD 01 17 B0 01 11 BD 01 AE 01 ........ ........
0000 0270: 0A CC 8E 87 80 00 DE 01 D0 7A 02 2E 7F 03 7E 23 ........ .z....~#
0000 0280: 00 41 D0 04 6B 22 03 24 00 02 40 02 40 02 40 20 .A..k".$ ..@.@.@
0000 0290: 02 41 05 76 22 04 41 80 01 20 04 41 80 01 4B 1B .A.v".A. . .A..K.
0000 02A0: 22 05 41 05 74 22 06 41 7F 4C 0D 00 02 40 20 06 ".A.t".A .L...@ .
0000 02B0: 41 08 10 BE 01 22 04 45 0D 00 20 04 42 00 37 03 A....".E .. .B.7.
0000 02C0: 10 20 04 41 20 3A 00 00 20 04 41 18 6A 42 00 37 . .A :.. .A.jB.7
0000 02D0: 03 00 20 03 41 F0 01 6A 41 AC BD C0 00 10 8C 01 .. .A..j A.......
0000 02E0: 20 03 29 03 F8 01 21 31 20 03 29 03 F0 01 21 32 .)...!1 .)...!2
0000 02F0: 02 40 41 80 1C 41 04 10 BE 01 22 06 45 0D 00 20 .@A..A.. ..".E..
0000 0300: 03 41 80 02 6A 41 F0 00 6A 42 80 80 80 80 20 37 .A..jA.. jB.... 7
0000 0310: 03 00 20 03 41 E8 02 6A 42 00 37 03 00 20 03 41 .. .A..j B.7.. .A
pulldown_cmark_wasm_bg.wasm-corrupt
0000 0190: BF BD EF BF BD EF BF BD EF BF BD 00 01 70 01 3F ........ .....p.?
0000 01A0: 3F 05 EF BF BD EF BF BD EF BF BD EF BF BD 00 01 ?....... ........
0000 01B0: 00 11 06 EF BF BD EF BF BD EF BF BD EF BF BD 00 ........ ........
0000 01C0: 01 7F 01 41 EF BF BD EF BF BD EF BF BD 00 0B 07 ...A.... ........
0000 01D0: D1 80 EF BF BD EF BF BD 00 05 06 6D 65 6D 6F 72 ........ ...memor
0000 01E0: 79 02 00 06 66 6F 72 6D 61 74 00 32 11 5F 5F 77 y...form at.2.__w
0000 01F0: 62 69 6E 64 67 65 6E 5F 6D 61 6C 6C 6F 63 00 EF bindgen_ malloc..
0000 0200: BF BD 01 12 5F 5F 77 62 69 6E 64 67 65 6E 5F 72 ....__wb indgen_r
0000 0210: 65 61 6C 6C 6F 63 00 EF BF BD 01 0F 5F 5F 77 62 ealloc.. ....__wb
0000 0220: 69 6E 64 67 65 6E 5F 66 72 65 65 00 EF BF BD 01 indgen_f ree.....
0000 0230: 09 F4 80 80 80 00 01 00 41 01 0B 3E EF BF BD 01 ........ A..>....
0000 0240: EF BF BD 01 08 EF BF BD 01 EF BF BD 01 7B 29 EF ........ .....{).
0000 0250: BF BD 01 EF BF BD 01 EF BF BD 01 EF BF BD 01 EF ........ ........
0000 0260: BF BD 01 1F EF BF BD 01 EF BF BD 01 EF BF BD 01 ........ ........
0000 0270: 26 4D EF BF BD 01 EF BF BD 01 EF BF BD 01 EF BF &M...... ........
0000 0280: BD 01 EF BF BD 01 EF BF BD 01 37 47 EF BF BD 01 ........ ..7G....
0000 0290: EF BF BD 01 EF BF BD 01 38 EF BF BD 01 EF BF BD ........ 8.......
0000 02A0: 01 EF BF BD 01 EF BF BD 01 EF BF BD 01 EF BF BD ........ ........
0000 02B0: 01 EF BF BD 01 EF BF BD 01 EF BF BD 01 39 EF BF ........ .....9..
0000 02C0: BD 01 EF BF BD 01 EF BF BD 01 EF BF BD 01 EF BF ........ ........
0000 02D0: BD 01 EF BF BD 01 53 EF BF BD 01 EF BF BD 01 40 ......S. .......@
0000 02E0: EF BF BD 01 EF BF BD 01 EF BF BD 01 EF BF BD 01 ........ ........
0000 02F0: EF BF BD 01 EF BF BD 01 EF BF BD 01 17 EF BF BD ........ ........
0000 0300: 01 11 EF BF BD 01 EF BF BD 01 0A CC 8E EF BF BD ........ ........
0000 0310: EF BF BD 00 EF BF BD 01 EF BF BD 7A 02 2E 7F 03 ........ ...z....
┌──────────────────────────────────────────────────────────────────────────────┐
│Arrow keys move F find RET next difference ESC quit T move top │
│C ASCII/EBCDIC E edit file G goto position Q quit B move bottom │
└──────────────────────────────────────────────────────────────────────────────┘
Aucun commentaire:
Enregistrer un commentaire