This repository has been archived by the owner on Aug 7, 2023. It is now read-only.
Replies: 1 comment 1 reply
-
I have tested it with express: Result is the same/ In case of hosting in Deta micros static binary file is returned currupted. It looks that problem is in Deta. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am returning a font file using fastify/static:
const app = require('fastify')({
logger: true
});
app.register(require('@fastify/static'), {
root: __dirname
})
app.get('/', async (request, reply) => {
reply.sendFile('font.ttf',{ cacheControl: false })
})
app.listen(3000, (err, address) => {
if (err) {
throw err
}
console.log( "Server is now listening on " + address);
})
module.exports = app;
When hosting on localhost, I get the correct 165 kb source file:
HTTP/1.1 200 OK
accept-ranges: bytes
last-modified: Fri, 15 Jul 2022 11:03:32 GMT
Date: Mon, 14 Nov 2022 07:24:01 GMT
etag: W/"286ac-18201872ba0"
content-type: font/ttf
content-length: 165548
content: 00 01 00 00 00 0D 00 80 00 03 00 50 46 46 54 4D 6B BE 47 B9 00 02 ...
When hosting on Deta micros (deta.sh), I get corrupt 200 kb file:
HTTP/1.1 200 OK
Date: Mon, 14 Nov 2022 07:36:10 GMT
Content-Type: font/ttf
Accept-Ranges: bytes
Etag: W/"286ac-4972121400"
Last-Modified: Mon, 31 Dec 1979 00:00:00 GMT
Server: Deta
content: 00 01 00 00 00 0D 00 EF BF BD 00 03 00 50 46 46 54 4D 6B EF BF BD 47 EF BF BD 00 02 ...
Every byte higher than 0x7F is changed to EF BF BD.
I have no possibility to debug app in deta micros lunux mashine. But if I
clone app back to my comp from deta i get correct 165 kb file. So, 'deta clone'
command return true file, but fastify/static - not.
Please help with advice where and what to do.
https://github.com/SAntropov/F_test - src test repository.
https://7gf86e.deta.dev/ - hosted in deta.sh app. It returns file font.ttf using fastify/static
Uzlopak (fastify/fastify#4420) says EF BF BD indicates that something tries to urlencode the file content.
Beta Was this translation helpful? Give feedback.
All reactions