diff --git a/l10n/de_DE.json b/l10n/de_DE.json
index cfc634b..69d0585 100644
--- a/l10n/de_DE.json
+++ b/l10n/de_DE.json
@@ -50,7 +50,8 @@
"This share was limited to {limit} downloads. There is still {downloadsLeft} left allowed.": "Diese Freigabe ist auf {limit} Downloads beschränkt. Es sind noch {downloadsLeft} Downloads zugelassen.",
"Deny download": "Download verhindern",
"Name, email": "Name, E-Mail-Adresse",
- "Password must be at least 6 characters long": "Passwort muss mindestens 6 Zeichen lang sein"
+ "Password must be at least 6 characters long": "Passwort muss mindestens 6 Zeichen lang sein",
+ "Limit needs to be positive number": "Das Limit muss eine positive Zahl sein"
},
"pluralForm": "nplurals=2; plural=(n != 1);"
}
\ No newline at end of file
diff --git a/l10n/en_GB.json b/l10n/en_GB.json
index 5a5db09..fe27168 100644
--- a/l10n/en_GB.json
+++ b/l10n/en_GB.json
@@ -50,7 +50,8 @@
"This share was limited to {limit} downloads. There is still {downloadsLeft} left allowed.": "This share was limited to {limit} downloads. There is still {downloadsLeft} left allowed.",
"Deny download": "Deny download",
"Name, email": "Name, email",
- "Password must be at least 6 characters long": "Password must be at least 6 characters long"
+ "Password must be at least 6 characters long": "Password must be at least 6 characters long",
+ "Limit needs to be positive number": "Limit needs to be positive number"
},
"pluralForm": "nplurals=2; plural=(n != 1);"
}
\ No newline at end of file
diff --git a/src/components/DownloadLimit.vue b/src/components/DownloadLimit.vue
index 8b9db79..a780e91 100644
--- a/src/components/DownloadLimit.vue
+++ b/src/components/DownloadLimit.vue
@@ -6,6 +6,8 @@
@@ -41,6 +43,7 @@ export default {
count: null,
token: null,
loading: false,
+ isValidPositiveInteger: true,
}
},
computed: {
@@ -50,6 +53,12 @@ export default {
return t('nmcsharing', 'This share was limited to {limit} downloads. There is still {downloadsLeft} left allowed.',
{ limit: this.limit, downloadsLeft })
},
+ invalidIntegerError() {
+ if (!this.isValidPositiveInteger) {
+ return t('nmcsharing', 'Limit needs to be positive number')
+ }
+ return undefined
+ }
},
beforeMount() {
this.getInitialData()
@@ -78,6 +87,8 @@ export default {
this.isLimitEnabled = !this.isLimitEnabled
},
debounceUpdateLimit: debounce(300, async function(limit) {
+ this.isValidPositiveInteger = /^[1-9]\d*$/.test(limit)
+ this.$emit('limit-changed', !this.isValidPositiveInteger)
this.loading = true
// If the value is not correct, let's remove the limit
diff --git a/src/views/SharingDetailsTab.vue b/src/views/SharingDetailsTab.vue
index f559cd6..30a673d 100755
--- a/src/views/SharingDetailsTab.vue
+++ b/src/views/SharingDetailsTab.vue
@@ -105,6 +105,7 @@
{{ shareButtonText }}
@@ -207,6 +208,7 @@ export default {
password: this.share.password,
label: this.share.label,
},
+ limitError: false
}
},
@@ -705,6 +707,9 @@ export default {
return true
},
+ handleLimitChangeEvent(payload) {
+ this.limitError = payload
+ },
getShareTypeIcon(type) {
switch (type) {
case this.SHARE_TYPES.SHARE_TYPE_LINK: