Explorar o código

validate if number of days is not integer value

ryuichi-e %!s(int64=5) %!d(string=hai) anos
pai
achega
8ea906e85a
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      src/client/js/components/ShareLinkForm.jsx

+ 3 - 0
src/client/js/components/ShareLinkForm.jsx

@@ -83,6 +83,9 @@ class ShareLinkForm extends React.Component {
     }
 
     if (expirationType === 'numberOfDays') {
+      if (!isInteger(Number(this.state.numberOfDays))) {
+        throw new Error('Number of days is invalid value.');
+      }
       const date = new Date();
       date.setDate(date.getDate() + Number(this.state.numberOfDays));
       expiredAt = date;