Skip to content

Commit

Permalink
added validation to stop trailing slashes in arr urls
Browse files Browse the repository at this point in the history
  • Loading branch information
petersem committed Jan 16, 2024
1 parent e3491fb commit bd25d2a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
17 changes: 16 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1595,7 +1595,22 @@ app.post(
.custom((value, { req }) => {
if(isNaN(Date.parse("2100-01-01T" + value)) == true && value.length !== 0) throw new Error("Sleep end time must be in 24 hour format hh:mm (eg. 07:15 or 23:30)");
return true;
})
}),
check("sonarrUrl")
.custom((value, { req }) => {
if(value.endsWith('/') == true && value.length !== 0) throw new Error("Sonarr URL cannot have a trailing slash");
return true;
}),
check("radarrUrl")
.custom((value, { req }) => {
if(value.endsWith('/') == true && value.length !== 0) throw new Error("Radarr URL cannot have a trailing slash");
return true;
}),
check("readarrUrl")
.custom((value, { req }) => {
if(value.endsWith('/') == true && value.length !== 0) throw new Error("Readarr URL cannot have a trailing slash");
return true;
})
],
(req, res) => {
//fields value holder. Also sets default values in form passed without them.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "posterr",
"version": "1.16.8",
"version": "1.16.9",
"description": "A digital display for your media",
"main": "index.js",
"bin": "index.js",
Expand Down

0 comments on commit bd25d2a

Please sign in to comment.