Skip to content
This repository was archived by the owner on Jun 5, 2023. It is now read-only.

Commit ed32682

Browse files
committed
Fixed specification key formation.
1 parent 9be07b1 commit ed32682

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

catalog/src/controller/contentController.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,10 @@ export class ContentController {
127127
const openApiIndexBuilder = new OpenApiIndexBuilder();
128128

129129
for (const fileName of fileNames) {
130+
const specKey = fileName.startsWith("/") ? fileName.substr(1) : fileName;
130131
const filePath = path.resolve(specsFolderPath, fileName);
131132
const spec: OpenApiSpec30 = JSON.parse(await fs.promises.readFile(filePath, defaultFileEncoding));
132-
openApiIndexBuilder.appendSpec(fileName, spec);
133+
openApiIndexBuilder.appendSpec(specKey, spec);
133134
}
134135

135136
const searchIndex = openApiIndexBuilder.buildIndex();

catalog/src/publishing/openApiPublisher.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@ export class OpenApiPublisher implements IPublisher {
1919
const downloadKeys = await this.specsBlobStorage.listBlobs();
2020

2121
for (const blobKey of downloadKeys) {
22-
const specContent = await this.specsBlobStorage.downloadBlob(blobKey);
22+
const specKey = blobKey.startsWith("/") ? blobKey.substr(1) : blobKey;
23+
const specContent = await this.specsBlobStorage.downloadBlob(specKey);
2324
const openApiSpec: OpenApiSpec30 = JSON.parse(Utils.uint8ArrayToString(specContent));
2425

25-
openApiIndexBuilder.appendSpec(blobKey, openApiSpec);
26+
openApiIndexBuilder.appendSpec(specKey, openApiSpec);
2627

27-
await this.outputBlobStorage.uploadBlob(`/specs/${blobKey}`, specContent, "application/json");
28+
await this.outputBlobStorage.uploadBlob(`/specs/${specKey}`, specContent, "application/json");
2829
this.logger.trackEvent("Publishing", { message: `Publishing OpenAPI spec ${openApiSpec.info.title}...` });
2930
}
3031

0 commit comments

Comments
 (0)