Skip to content

Commit

Permalink
Fix TriG documents not being PUT-able
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensworks committed Jun 11, 2021
1 parent ded263a commit d7aa118
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/storage/mapping/ExtensionBasedMapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import { BaseFileIdentifierMapper } from './BaseFileIdentifierMapper';
import type { FileIdentifierMapperFactory, ResourceLink } from './FileIdentifierMapper';

export class ExtensionBasedMapper extends BaseFileIdentifierMapper {
public static readonly mimeFallback: Record<string, string> = {
'application/trig': 'trig',
};

private readonly types: Record<string, any>;

public constructor(base: string, rootFilepath: string, overrideTypes = { acl: TEXT_TURTLE, meta: TEXT_TURTLE }) {
Expand Down Expand Up @@ -42,7 +46,7 @@ export class ExtensionBasedMapper extends BaseFileIdentifierMapper {
// If the extension of the identifier matches a different content-type than the one that is given,
// we need to add a new extension to match the correct type.
} else if (contentType !== await this.getContentTypeFromPath(filePath)) {
const extension = mime.extension(contentType);
const extension = mime.extension(contentType) || ExtensionBasedMapper.mimeFallback[contentType];
if (!extension) {
this.logger.warn(`No extension found for ${contentType}`);
throw new NotImplementedHttpError(`Unsupported content type ${contentType}`);
Expand Down

0 comments on commit d7aa118

Please sign in to comment.