Skip to content

Commit

Permalink
Fix link validations
Browse files Browse the repository at this point in the history
  • Loading branch information
fleebeee committed Dec 21, 2016
1 parent 3890ef1 commit f7e8296
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/app/models/course.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const CourseSchema = new Schema({
validate: {
validator: (v) => {
/* eslint-disable max-len */
return /^$|^https:\/\/mycourses\.aalto\.fi\/course\/view\.php\?id=[0-9]+$/g.test(v);
return /^$|^https:\/\/(www\.)?mycourses\.aalto\.fi\/course\/view\.php\?id=[0-9]+$/g.test(v);
},
message: '\'{VALUE}\' is not a valid MyCoursesLink. It should satisfy this RegExp: /^$|^https:\\/\\/mycourses\\.aalto\\.fi\\/course\\/view\\.php\\?id=[0-9]+$/g',
/* eslint-enable max-len */
Expand All @@ -39,7 +39,7 @@ const CourseSchema = new Schema({
validate: {
validator: (v) => {
/* eslint-disable max-len */
return /^$|^http:\/\/tenttiarkisto\.fi.*$/g.test(v);
return /^$|^http:\/\/(www\.)?tenttiarkisto\.fi.*$/g.test(v);
},
message: '\'{VALUE}\' is not a valid TenttiArkisto link. It should satisfy this RegExp: ',
/* eslint-enable max-len */
Expand Down

0 comments on commit f7e8296

Please sign in to comment.