summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2024-01-18 13:24:01 +0100
committerGitHub <noreply@github.com>2024-01-18 13:24:01 +0100
commit82fce120719d002ba0fa7d2f853652fd889130f1 (patch)
tree2f443e9045f344452e25f23f9adeffa84315d8f2 /apps
parent48ea4da227ff68c31f0912b5ae428d89be58dd2e (diff)
parent00c26fc0850aae1ab3ed4c341c7400c7c990c15e (diff)
downloadnextcloud-server-82fce120719d002ba0fa7d2f853652fd889130f1.tar.gz
nextcloud-server-82fce120719d002ba0fa7d2f853652fd889130f1.zip
Merge pull request #42172 from nextcloud/fix/quota-with-non-english-locale-stable27
[stable27] fix(Users/Quota setting): Prevent floating point value from getting truncated in locales other than english
Diffstat (limited to 'apps')
-rw-r--r--apps/settings/src/components/UserList.vue5
-rw-r--r--apps/settings/src/components/UserList/UserRow.vue7
-rw-r--r--apps/settings/src/store/users.js3
3 files changed, 9 insertions, 6 deletions
diff --git a/apps/settings/src/components/UserList.vue b/apps/settings/src/components/UserList.vue
index 9a97aff085f..f9553445e13 100644
--- a/apps/settings/src/components/UserList.vue
+++ b/apps/settings/src/components/UserList.vue
@@ -262,6 +262,7 @@ import Vue from 'vue'
import NcModal from '@nextcloud/vue/dist/Components/NcModal.js'
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import NcMultiselect from '@nextcloud/vue/dist/Components/NcMultiselect.js'
+import { formatFileSize, parseFileSize } from '@nextcloud/files'
import userRow from './UserList/UserRow.vue'
@@ -486,10 +487,10 @@ export default {
*/
validateQuota(quota) {
// only used for new presets sent through @Tag
- const validQuota = OC.Util.computerFileSize(quota)
+ const validQuota = parseFileSize(quota, true)
if (validQuota !== null && validQuota >= 0) {
// unify format output
- quota = OC.Util.humanFileSize(OC.Util.computerFileSize(quota))
+ quota = formatFileSize(parseFileSize(quota, true))
this.newUser.quota = { id: quota, label: quota }
return this.newUser.quota
}
diff --git a/apps/settings/src/components/UserList/UserRow.vue b/apps/settings/src/components/UserList/UserRow.vue
index dddf5abef8a..2e507107b73 100644
--- a/apps/settings/src/components/UserList/UserRow.vue
+++ b/apps/settings/src/components/UserList/UserRow.vue
@@ -268,6 +268,7 @@
<script>
import ClickOutside from 'vue-click-outside'
+import { formatFileSize, parseFileSize } from '@nextcloud/files'
import {
NcPopoverMenu,
@@ -688,7 +689,7 @@ export default {
await this.$store.dispatch('setUserData', {
userid: this.user.id,
key: 'quota',
- value: quota,
+ value: '' + parseFileSize(quota, true),
})
} catch (error) {
console.error(error)
@@ -706,10 +707,10 @@ export default {
*/
validateQuota(quota) {
// only used for new presets sent through @Tag
- const validQuota = OC.Util.computerFileSize(quota)
+ const validQuota = parseFileSize(quota, true)
if (validQuota !== null && validQuota >= 0) {
// unify format output
- return this.setUserQuota(OC.Util.humanFileSize(OC.Util.computerFileSize(quota)))
+ return this.setUserQuota(formatFileSize(parseFileSize(quota, true)))
}
// if no valid do not change
return false
diff --git a/apps/settings/src/store/users.js b/apps/settings/src/store/users.js
index 96e66044a0c..08177499d10 100644
--- a/apps/settings/src/store/users.js
+++ b/apps/settings/src/store/users.js
@@ -31,6 +31,7 @@ import api from './api.js'
import axios from '@nextcloud/axios'
import { generateOcsUrl } from '@nextcloud/router'
import logger from '../logger.js'
+import { parseFileSize } from '@nextcloud/files'
const orderGroups = function(groups, orderBy) {
/* const SORT_USERCOUNT = 1;
@@ -211,7 +212,7 @@ const mutations = {
},
setUserData(state, { userid, key, value }) {
if (key === 'quota') {
- const humanValue = OC.Util.computerFileSize(value)
+ const humanValue = parseFileSize(value, true)
state.users.find(user => user.id === userid)[key][key] = humanValue !== null ? humanValue : value
} else {
state.users.find(user => user.id === userid)[key] = value