Skip to content

Commit

Permalink
fix(filesystem-aws-s3): use correct path normalize function
Browse files Browse the repository at this point in the history
  • Loading branch information
marcj committed Apr 7, 2024
1 parent c89412c commit 58042a9
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions packages/filesystem-aws-s3/src/s3-adapter.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
import { FilesystemAdapter, FilesystemError, FilesystemFile, FileVisibility, Reporter } from '@deepkit/filesystem';
import { pathDirectory } from '@deepkit/core';
import { pathDirectory, pathNormalize } from '@deepkit/core';
import {
CopyObjectCommand,
DeleteObjectsCommand,
GetObjectAclCommand,
GetObjectCommand,
HeadObjectCommand,
ListObjectsCommand,
ObjectCannedACL,
PutObjectAclCommand,
PutObjectCommand,
S3Client,
S3ClientConfigType,
ObjectCannedACL
} from '@aws-sdk/client-s3';
import { normalizePath } from 'typedoc';

export interface FilesystemAwsS3Options extends S3ClientConfigType {
bucket: string;
Expand Down Expand Up @@ -54,8 +53,8 @@ export class FilesystemAwsS3Adapter implements FilesystemAdapter {
}

protected getRemotePath(path: string) {
path = normalizePath(path);
const base = this.options.path ? (normalizePath(this.options.path).slice(0) + '/') : '';
path = pathNormalize(path);
const base = this.options.path ? (pathNormalize(this.options.path).slice(0) + '/') : '';
if (path === '/') return base;
let remotePath = this.options.path ? base : '';
remotePath += path === '/' ? '' : path.slice(1);
Expand All @@ -69,7 +68,7 @@ export class FilesystemAwsS3Adapter implements FilesystemAdapter {

protected pathMapToVirtual(path: string): string {
//remove this.options.path from path
const base = this.options.path ? (normalizePath(this.options.path).slice(0) + '/') : '';
const base = this.options.path ? (pathNormalize(this.options.path).slice(0) + '/') : '';
return path.slice(base.length);
}

Expand Down

0 comments on commit 58042a9

Please sign in to comment.