Skip to content
This repository was archived by the owner on Jan 14, 2022. It is now read-only.

Commit 4ef42b4

Browse files
authored
Merge pull request #88 from pwa-builder/pwabuilder_issue1245
PWABuilder Issue 1245
2 parents 8ced653 + 75625f0 commit 4ef42b4

File tree

6 files changed

+12
-45
lines changed

6 files changed

+12
-45
lines changed

lib/manifestTools/validationRules/shortNameRequired.js

Lines changed: 0 additions & 18 deletions
This file was deleted.

lib/manifestTools/validationRules/shortNameRequiresSanitization.js

Lines changed: 0 additions & 22 deletions
This file was deleted.

lib/projectBuilder.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,13 @@ function createApps(w3cManifestInfo, rootDir, platforms, options, href, callback
124124
}
125125

126126
// determine the path where the app will be created
127-
options.appName = utils.sanitizeName(w3cManifestInfo.content.short_name.replace(/[^a-zA-Z0-9]/g, '_'));
127+
var appName = w3cManifestInfo.content.short_name || w3cManifestInfo.content.name;
128+
129+
if (!appName) {
130+
return Q.reject(new Error("manifest missing short_name or name (required field)")).nodeify(callback);
131+
}
132+
133+
options.appName = utils.sanitizeName(appName);
128134
var generatedAppDir = path.join(rootDir, options.appName);
129135

130136
// Add timestamp to manifest information for telemetry purposes only

lib/utils.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,11 @@ function newGuid () {
3838
s4() + '-' + s4() + s4() + s4();
3939
}
4040

41-
function sanitizeName (name) {
41+
function sanitizeName(name) {
4242
var sanitizedName = name;
43-
43+
4444
// Remove all invalid characters
45+
sanitizedName = sanitizedName.replace(/[^a-zA-Z0-9]/g, '_');
4546
sanitizedName = sanitizedName.replace(/\s+/g, '');
4647

4748
var currentLength;

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pwabuilder-lib",
3-
"version": "2.1.11",
3+
"version": "2.1.12",
44
"description": "PWA Builder Core Library",
55
"repository": {
66
"type": "git",

0 commit comments

Comments
 (0)