Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Ensure manifest.json not found in zip displays error #8261

Merged
merged 4 commits into from
Jul 6, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ export const validateLocalZip = async (files: Record<string, JSZipObject>) => {
const content = await manifestFiles[0].async('string');
result.manifestContent = JSON.parse(content);
result.zipContent = zipContent;
} else {
result.error = { manifestUrl: formatMessage('could not locate manifest.json in zip') };
}
} catch (err) {
// eslint-disable-next-line format-message/literal-pattern
Expand Down
8 changes: 3 additions & 5 deletions Composer/packages/lib/shared/src/skillsUtils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,9 @@ export const parseRuntimeKey = (

export const isManifestJson = (content) => {
try {
const urls = [
'https://schemas.botframework.com/schemas/skills/v2.1/skill-manifest.json',
'https://schemas.botframework.com/schemas/skills/v2.2/skill-manifest.json',
];
return urls.includes(JSON.parse(content).$schema);
const versions = ['/v2.1/skill-manifest.json', '/v2.2/skill-manifest.json'];
const schema = JSON.parse(content).$schema;
return versions.some((v) => schema.endsWith(v));
} catch (e) {
return false;
}
Expand Down