Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/s3/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ export const mimeMap: Record<string, string> = {

export const PublicBucketBaseURL = process.env.S3_EXTERNAL_BASE_URL
? `${process.env.S3_EXTERNAL_BASE_URL}/${process.env.S3_PUBLIC_BUCKET}`
: `${process.env.S3_USE_SSL ? 'https' : 'http'}://${process.env.S3_ENDPOINT}/${process.env.S3_PUBLIC_BUCKET}`;
: `${process.env.S3_USE_SSL === 'true' ? 'https' : 'http'}://${process.env.S3_ENDPOINT}:${process.env.S3_PORT}/${process.env.S3_PUBLIC_BUCKET}`;
11 changes: 7 additions & 4 deletions modules/tool/parseMod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ export const getIconPath = (name: string) => `${PublicBucketBaseURL}${UploadTool

export const parseMod = async ({
rootMod,
filename
filename,
temp = false
}: {
rootMod: ToolSetType | ToolType;
filename: string;
temp?: boolean;
}) => {
const tools: ToolType[] = [];
const checkRootModToolSet = (rootMod: ToolType | ToolSetType): rootMod is ToolSetType => {
Expand All @@ -20,14 +22,15 @@ export const parseMod = async ({
if (checkRootModToolSet(rootMod)) {
const toolsetId = rootMod.toolId;

const parentIcon = rootMod.icon || getIconPath(`${toolsetId}/logo`);
const parentIcon = rootMod.icon || getIconPath(`${temp ? 'temp/' : ''}${toolsetId}/logo`);

const children = rootMod.children;

for (const child of children) {
const childToolId = child.toolId;

const childIcon = child.icon || rootMod.icon || getIconPath(`${childToolId}/logo`);
const childIcon =
child.icon || rootMod.icon || getIconPath(`${temp ? 'temp/' : ''}${childToolId}/logo`);

// Generate version for child tool
const childVersion = generateToolVersion(child.versionList);
Expand Down Expand Up @@ -59,7 +62,7 @@ export const parseMod = async ({
// is not toolset
const toolId = rootMod.toolId;

const icon = rootMod.icon || getIconPath(`${toolId}/logo`);
const icon = rootMod.icon || getIconPath(`${temp ? 'temp/' : ''}${toolId}/logo`);

tools.push({
...rootMod,
Expand Down
5 changes: 3 additions & 2 deletions modules/tool/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ export const parsePkg = async (filepath: string, temp: boolean = true) => {

const tools = await parseMod({
rootMod: mod,
filename: join(tempDir, 'index.js')
filename: join(tempDir, 'index.js'),
temp
});

await Promise.all([rm(tempDir, { recursive: true }), rm(filepath)]);
Expand All @@ -91,7 +92,7 @@ export const parseUploadedTool = async (objectName: string) => {
});

if (!filepath) return Promise.reject('Upload Tool Error: File not found');
const tools = await parsePkg(filepath);
const tools = await parsePkg(filepath, true);
// 4. remove the uploaded pkg file
await privateS3Server.removeFile(objectName);
return tools;
Expand Down