From 777daa10ad6896b5cfe161721120d4d7e00c3d32 Mon Sep 17 00:00:00 2001 From: Andre Wanlin Date: Sun, 31 Oct 2021 19:56:06 -0500 Subject: [PATCH 1/4] Fixed s3 path join to work under any os Signed-off-by: Andre Wanlin --- .changeset/tender-bugs-sort.md | 5 +++++ packages/techdocs-common/src/stages/publish/awsS3.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/tender-bugs-sort.md diff --git a/.changeset/tender-bugs-sort.md b/.changeset/tender-bugs-sort.md new file mode 100644 index 0000000000..b6ad29ba66 --- /dev/null +++ b/.changeset/tender-bugs-sort.md @@ -0,0 +1,5 @@ +--- +'@backstage/techdocs-common': patch +--- + +Updated to properly join URL segments under any OS diff --git a/packages/techdocs-common/src/stages/publish/awsS3.ts b/packages/techdocs-common/src/stages/publish/awsS3.ts index 29eecb8d03..5606ff1fd4 100644 --- a/packages/techdocs-common/src/stages/publish/awsS3.ts +++ b/packages/techdocs-common/src/stages/publish/awsS3.ts @@ -357,7 +357,7 @@ export class AwsS3Publish implements PublisherBase { : lowerCaseEntityTripletInStoragePath(decodedUriNoRoot); // Re-prepend the root path to the relative file path - const filePath = path.join(this.bucketRootPath, filePathNoRoot); + const filePath = path.posix.join(this.bucketRootPath, filePathNoRoot); // Files with different extensions (CSS, HTML) need to be served with different headers const fileExtension = path.extname(filePath); From 4848c9cb2094e9691340c9e68ed65e4688b47753 Mon Sep 17 00:00:00 2001 From: Andre Wanlin Date: Sun, 31 Oct 2021 19:58:51 -0500 Subject: [PATCH 2/4] Fixed other instances of same issue Signed-off-by: Andre Wanlin --- packages/techdocs-common/src/stages/publish/awsS3.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/techdocs-common/src/stages/publish/awsS3.ts b/packages/techdocs-common/src/stages/publish/awsS3.ts index 5606ff1fd4..f0616e4cd3 100644 --- a/packages/techdocs-common/src/stages/publish/awsS3.ts +++ b/packages/techdocs-common/src/stages/publish/awsS3.ts @@ -306,7 +306,7 @@ export class AwsS3Publish implements PublisherBase { ? entityTriplet : lowerCaseEntityTriplet(entityTriplet); - const entityRootDir = path.join(this.bucketRootPath, entityDir); + const entityRootDir = path.posix.join(this.bucketRootPath, entityDir); const stream = this.storageClient .getObject({ @@ -396,7 +396,7 @@ export class AwsS3Publish implements PublisherBase { ? entityTriplet : lowerCaseEntityTriplet(entityTriplet); - const entityRootDir = path.join(this.bucketRootPath, entityDir); + const entityRootDir = path.posix.join(this.bucketRootPath, entityDir); await this.storageClient .headObject({ From 7240d33df360b4f4ac67f74e803eec71da8561c6 Mon Sep 17 00:00:00 2001 From: Andre Wanlin Date: Wed, 3 Nov 2021 07:30:56 -0500 Subject: [PATCH 3/4] Also fixing for Google Storage Signed-off-by: Andre Wanlin --- .../techdocs-common/src/stages/publish/googleStorage.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/techdocs-common/src/stages/publish/googleStorage.ts b/packages/techdocs-common/src/stages/publish/googleStorage.ts index 5a142e800a..77c366315c 100644 --- a/packages/techdocs-common/src/stages/publish/googleStorage.ts +++ b/packages/techdocs-common/src/stages/publish/googleStorage.ts @@ -231,7 +231,7 @@ export class GoogleGCSPublish implements PublisherBase { ? entityTriplet : lowerCaseEntityTriplet(entityTriplet); - const entityRootDir = path.join(this.bucketRootPath, entityDir); + const entityRootDir = path.posix.join(this.bucketRootPath, entityDir); const fileStreamChunks: Array = []; this.storageClient @@ -270,7 +270,7 @@ export class GoogleGCSPublish implements PublisherBase { : lowerCaseEntityTripletInStoragePath(decodedUriNoRoot); // Re-prepend the root path to the relative file path - const filePath = path.join(this.bucketRootPath, filePathNoRoot); + const filePath = path.posix.join(this.bucketRootPath, filePathNoRoot); // Files with different extensions (CSS, HTML) need to be served with different headers const fileExtension = path.extname(filePath); @@ -310,7 +310,7 @@ export class GoogleGCSPublish implements PublisherBase { ? entityTriplet : lowerCaseEntityTriplet(entityTriplet); - const entityRootDir = path.join(this.bucketRootPath, entityDir); + const entityRootDir = path.posix.join(this.bucketRootPath, entityDir); this.storageClient .bucket(this.bucketName) From f3c7eec64be17a50c38d7f13270773e14fd50386 Mon Sep 17 00:00:00 2001 From: Andre Wanlin Date: Fri, 5 Nov 2021 14:48:44 -0500 Subject: [PATCH 4/4] Updated changeset to reflect changes made Signed-off-by: Andre Wanlin --- .changeset/techdocs-tender-bugs-sort.md | 5 +++++ .changeset/tender-bugs-sort.md | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 .changeset/techdocs-tender-bugs-sort.md delete mode 100644 .changeset/tender-bugs-sort.md diff --git a/.changeset/techdocs-tender-bugs-sort.md b/.changeset/techdocs-tender-bugs-sort.md new file mode 100644 index 0000000000..be670b06ff --- /dev/null +++ b/.changeset/techdocs-tender-bugs-sort.md @@ -0,0 +1,5 @@ +--- +'@backstage/techdocs-common': patch +--- + +Updated to properly join URL segments under any OS for both AWS S3 and GCP diff --git a/.changeset/tender-bugs-sort.md b/.changeset/tender-bugs-sort.md deleted file mode 100644 index b6ad29ba66..0000000000 --- a/.changeset/tender-bugs-sort.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/techdocs-common': patch ---- - -Updated to properly join URL segments under any OS