pure-upload
Advanced tools
Comparing version 4.0.1 to 4.1.0
CHANGELOG | ||
=== | ||
4.1.0 | ||
-- | ||
Added option to allow upload of empty files | ||
4.0.1 | ||
@@ -4,0 +8,0 @@ -- |
@@ -157,2 +157,3 @@ "use strict"; | ||
multiple: true, | ||
allowEmptyFile: false | ||
}; | ||
@@ -342,3 +343,3 @@ }; | ||
var maxFileSize = this.options.maxFileSize * 1024 * 1024; // max file size in bytes | ||
if (file.size > maxFileSize || file.size === 0) | ||
if (file.size > maxFileSize || (!this.options.allowEmptyFile && file.size === 0)) | ||
return false; | ||
@@ -345,0 +346,0 @@ return true; |
@@ -58,3 +58,3 @@ export function addEventHandler(el: Element | HTMLElement, event: string, handler: (ev: UIEvent) => void) { | ||
for (var nextKey in source) { | ||
for (let nextKey in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, nextKey) && (to[nextKey] === undefined || to[nextKey] === null)) { | ||
@@ -147,2 +147,3 @@ to[nextKey] = source[nextKey]; | ||
manualStart?: boolean; | ||
allowEmptyFile?: boolean; | ||
@@ -291,2 +292,3 @@ onFileAdded?: (file: IUploadFile) => void; | ||
multiple: true, | ||
allowEmptyFile: false | ||
}; | ||
@@ -490,3 +492,3 @@ } | ||
let maxFileSize = this.options.maxFileSize * 1024 * 1024; // max file size in bytes | ||
if (file.size > maxFileSize || file.size === 0) return false; | ||
if (file.size > maxFileSize || (!this.options.allowEmptyFile && file.size === 0)) return false; | ||
return true; | ||
@@ -493,0 +495,0 @@ } |
{ | ||
"name": "pure-upload", | ||
"version": "4.0.1", | ||
"version": "4.1.0", | ||
"description": "The pure upload library without dependencies", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -56,2 +56,3 @@ declare module "pure-upload" { | ||
manualStart?: boolean; | ||
allowEmptyFile?: boolean; | ||
onFileAdded?: (file: IUploadFile) => void; | ||
@@ -58,0 +59,0 @@ onFileSelected?: (file: IUploadFile) => void; |
@@ -79,2 +79,3 @@ # Pure-upload | ||
manualStart?: boolean; | ||
allowEmptyFile?: boolean; | ||
onFileAdded?: (file: IUploadFile) => void; | ||
@@ -81,0 +82,0 @@ onFileSelected?: (file: IUploadFile) => void; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
75502
1694
118