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

Added logging and error for when plugin structure is incorrect #731

Merged
merged 1 commit into from
Jul 3, 2015
Merged
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
12 changes: 11 additions & 1 deletion plugins/content/bower/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,17 @@ function handleUploadedPlugin (req, res, next) {

// first entry should be our target directory
var packageJson;
var canonicalDir = path.join(outputPath, files[0]);
var canonicalDir;

if (files.indexOf("bower.json") != -1) {
// We're at the root level so the zip file is in the expected format
canonicalDir = outputPath
}
else {
logger.log('error', 'Received plugin zip file with unexpected folder structure');
return next(new Error('Cannot find expected bower.json file in the plugin root, please check the structure of your zip file and try again.'));
}

try {
packageJson = require(path.join(canonicalDir, 'bower.json'));
} catch (error) {
Expand Down