Skip to content

Commit

Permalink
fix: Use posix path library to be OS independent
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimvh committed Aug 18, 2020
1 parent 381dae4 commit b489d69
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/storage/FileResourceStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { InteractionController } from '../util/InteractionController';
import { MetadataController } from '../util/MetadataController';
import { MethodNotAllowedHttpError } from '../util/errors/MethodNotAllowedHttpError';
import { NotFoundHttpError } from '../util/errors/NotFoundHttpError';
import { posix } from 'path';
import { Quad } from 'rdf-js';
import { Readable } from 'stream';
import { Representation } from '../ldp/representation/Representation';
Expand All @@ -16,7 +17,8 @@ import { UnsupportedMediaTypeHttpError } from '../util/errors/UnsupportedMediaTy
import { CONTENT_TYPE_QUADS, DATA_TYPE_BINARY, DATA_TYPE_QUAD } from '../util/ContentTypes';
import { createReadStream, createWriteStream, promises as fsPromises, Stats } from 'fs';
import { ensureTrailingSlash, trimTrailingSlashes } from '../util/Util';
import { extname, join as joinPath, normalize as normalizePath } from 'path';

const { extname, join: joinPath, normalize: normalizePath } = posix;

/**
* Resource store storing its data in the file system backend.
Expand Down
4 changes: 3 additions & 1 deletion test/unit/storage/FileResourceStore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { ConflictHttpError } from '../../../src/util/errors/ConflictHttpError';
import { DataFactory } from 'n3';
import { FileResourceStore } from '../../../src/storage/FileResourceStore';
import { InteractionController } from '../../../src/util/InteractionController';
import { join as joinPath } from 'path';
import { MetadataController } from '../../../src/util/MetadataController';
import { MethodNotAllowedHttpError } from '../../../src/util/errors/MethodNotAllowedHttpError';
import { NotFoundHttpError } from '../../../src/util/errors/NotFoundHttpError';
import { posix } from 'path';
import { Readable } from 'stream';
import { RepresentationMetadata } from '../../../src/ldp/representation/RepresentationMetadata';
import streamifyArray from 'streamify-array';
Expand All @@ -18,6 +18,8 @@ import { LDP, RDF, STAT, TERMS, XML } from '../../../src/util/Prefixes';
import { LINK_TYPE_LDP_BC, LINK_TYPE_LDPR } from '../../../src/util/LinkTypes';
import { literal, namedNode, quad as quadRDF, triple } from '@rdfjs/data-model';

const { join: joinPath } = posix;

const base = 'http://test.com/';
const root = '/Users/default/home/public/';

Expand Down

0 comments on commit b489d69

Please sign in to comment.