Update publishHelpers.js
Accept space in filename from user, and replace the space to dash. Since a lot of users are used to typing out with spaces, better UX and less errors thrown out for invalid names.
This commit is contained in:
parent
c6b2d2fed1
commit
49f1fb8745
1 changed files with 3 additions and 1 deletions
|
@ -30,6 +30,8 @@ module.exports = {
|
||||||
if (invalidCharacters) {
|
if (invalidCharacters) {
|
||||||
throw new Error('The name you provided is not allowed. Please use A-Z, a-z, 0-9, and "-" only.');
|
throw new Error('The name you provided is not allowed. Please use A-Z, a-z, 0-9, and "-" only.');
|
||||||
}
|
}
|
||||||
|
name = str.replace(/\s+/g, '-'); //replace space with dash/hyphen
|
||||||
|
|
||||||
// validate license
|
// validate license
|
||||||
if ((license.indexOf('Public Domain') === -1) && (license.indexOf('Creative Commons') === -1)) {
|
if ((license.indexOf('Public Domain') === -1) && (license.indexOf('Creative Commons') === -1)) {
|
||||||
throw new Error('Only posts with a license of "Public Domain" or "Creative Commons" are eligible for publishing through spee.ch');
|
throw new Error('Only posts with a license of "Public Domain" or "Creative Commons" are eligible for publishing through spee.ch');
|
||||||
|
|
Loading…
Reference in a new issue