Skip to content

Commit 9a51eed

Browse files
authored
Merge pull request #502 from OpenSignLabs/fix_maxupload
2 parents 1cefe01 + a675a3c commit 9a51eed

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

apps/OpenSign/src/pages/Form.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ function Form() {
2828
}
2929

3030
const Forms = (props) => {
31+
const maxFileSize = 20;
3132
const navigate = useNavigate();
3233
const [signers, setSigners] = useState([]);
3334
const [folder, setFolder] = useState({ ObjectId: "", Name: "" });
@@ -56,17 +57,17 @@ const Forms = (props) => {
5657
try {
5758
let files = e.target.files;
5859
if (typeof files[0] !== "undefined") {
59-
const mb = Math.round(files[0].bytes / Math.pow(1024, 2));
60-
if (mb > 10) {
60+
const mb = Math.round(files[0].size / Math.pow(1024, 2));
61+
if (mb > maxFileSize) {
6162
alert(
62-
`The selected file size is too large. Please select a file less than ${Math.round(
63-
10
64-
)} MB`
63+
`The selected file size is too large. Please select a file less than ${maxFileSize} MB`
6564
);
65+
setFileUpload([]);
66+
e.target.value = "";
6667
return;
68+
} else {
69+
handleFileUpload(files[0]);
6770
}
68-
69-
handleFileUpload(files[0]);
7071
} else {
7172
alert("Please select file.");
7273
return false;
@@ -114,10 +115,10 @@ const Forms = (props) => {
114115
const url = file.link;
115116
const mb = Math.round(file.bytes / Math.pow(1024, 2));
116117

117-
if (mb > 10) {
118+
if (mb > maxFileSize) {
118119
setTimeout(() => {
119120
alert(
120-
`The selected file size is too large. Please select a file less than 10 MB`
121+
`The selected file size is too large. Please select a file less than ${maxFileSize} MB`
121122
);
122123
}, 500);
123124
return;

apps/OpenSignServer/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ if (process.env.SMTP_ENABLE) {
6969
await transporterMail.verify();
7070
isMailAdapter = true;
7171
} catch (err) {
72-
console.dir('Please provide valid SMTP credentials');
7372
isMailAdapter = false;
73+
console.log('Please provide valid SMTP credentials');
7474
}
7575
} else if (process.env.MAILGUN_API_KEY) {
7676
try {
@@ -83,7 +83,7 @@ if (process.env.SMTP_ENABLE) {
8383
isMailAdapter = true;
8484
} catch (error) {
8585
isMailAdapter = false;
86-
console.dir('Please provide valid Mailgun credentials');
86+
console.log('Please provide valid Mailgun credentials');
8787
}
8888
}
8989

@@ -95,6 +95,7 @@ export const config = {
9595
},
9696
appId: process.env.APP_ID || 'myAppId',
9797
maxLimit: 500,
98+
maxUploadSize: '30mb',
9899
masterKey: process.env.MASTER_KEY, //Add your master key here. Keep it secret!
99100
masterKeyIps: ['0.0.0.0/0', '::/0'], // '::1'
100101
serverURL: process.env.SERVER_URL || 'http://localhost:8080/app', // Don't forget to change to https if needed

0 commit comments

Comments
 (0)