Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: serve index.tab files as text files #230

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
13 changes: 11 additions & 2 deletions src/providers/r2Provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,19 @@ function r2MetadataToHeaders(
): HttpResponseHeaders {
const { httpMetadata } = object;

let contentType: string;
flakey5 marked this conversation as resolved.
Show resolved Hide resolved
if (object.httpMetadata?.contentType !== undefined) {
contentType = object.httpMetadata.contentType;
} else {
// Serve .tab files as text files
contentType = object.key.endsWith('.tab')
? 'text/plain'
: 'application/octet-stream';
}

return {
etag: object.httpEtag,
'content-type':
object.httpMetadata?.contentType ?? 'application/octet-stream',
'content-type': contentType,
'accept-range': 'bytes',
// https://github.com/nodejs/build/blob/e3df25d6a23f033db317a53ab1e904c953ba1f00/ansible/www-standalone/resources/config/nodejs.org?plain=1#L194-L196
'access-control-allow-origin': object.key.endsWith('.json') ? '*' : '',
Expand Down
Loading