szabodanika / microbin

A secure, configurable file-sharing and URL shortening web app written in Rust.
https://microbin.eu
BSD 3-Clause "New" or "Revised" License
2.71k stars 172 forks source link

Cannot save private or secret pasta when file upload is disabled #191

Open tbleiker opened 1 year ago

tbleiker commented 1 year ago

If MICROBIN_NO_FILE_UPLOAD is set to true, private or secret pasta cannot be saved. The following error occurs:

(index):300 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'files')
    at fileOversized ((index):300:30)
    at form.onsubmit ((index):216:17)
alefteris commented 1 year ago

Also with MICROBIN_NO_FILE_UPLOAD=true the following JS error is logged:

(index):279 Uncaught TypeError: Cannot read properties of null (reading 'addEventListener')
    at (index):279:22
(anonymous) @ (index):279

Pointing to:

hiddenFileButton.addEventListener('change', function () {
    attachFileButton.textContent = "Attached: " + this.files[0].name;
    fileOversized();
});