Skip to content

Commit

Permalink
fix(Calendar): Remove prodId() string validation
Browse files Browse the repository at this point in the history
Although the ProdId should be globally unique, but a specific format is not prescribed.
See https://www.rfc-editor.org/rfc/rfc5545#section-3.7.3

close #555
  • Loading branch information
sebbo2002 committed Jan 6, 2024
1 parent c7776f2 commit a5caeaa
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,21 +169,13 @@ export default class ICalCalendar {
return this.data.prodId;
}

const prodIdRegEx = /^\/\/(.+)\/\/(.+)\/\/([A-Z]{1,4})$/;

if (typeof prodId === 'string' && prodIdRegEx.test(prodId)) {
if (typeof prodId === 'string') {
this.data.prodId = prodId;
return this;
}
if (typeof prodId === 'string') {
throw new Error(
'`prodId` isn\'t formated correctly. See https://sebbo2002.github.io/ical-generator/develop/reference/'+
'classes/ICalCalendar.html#prodId'
);
}

if (typeof prodId !== 'object') {
throw new Error('`prodid` needs to be a valid formed string or an object!');
throw new Error('`prodid` needs to be a string or an object!');
}

if (!prodId.company) {
Expand Down

0 comments on commit a5caeaa

Please sign in to comment.