diff options
author | Marcel Klehr <mklehr@gmx.net> | 2023-12-06 14:09:09 +0100 |
---|---|---|
committer | Marcel Klehr <mklehr@gmx.net> | 2024-01-18 09:11:21 +0100 |
commit | fa2cf8d80538348b9a9c969f350ae49e2260b80c (patch) | |
tree | 863c4a3b33c1014122354d87f02ca8f27adde7e9 /apps | |
parent | 08801969ea6adeb505a91562b0b6f65317e47fc1 (diff) | |
download | nextcloud-server-fa2cf8d80538348b9a9c969f350ae49e2260b80c.tar.gz nextcloud-server-fa2cf8d80538348b9a9c969f350ae49e2260b80c.zip |
fix(Users/Quota setting): Prevent floating point value from getting truncated in locales other than english
fixes #18468
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/settings/src/components/UserList.vue | 5 | ||||
-rw-r--r-- | apps/settings/src/components/UserList/UserRow.vue | 7 | ||||
-rw-r--r-- | apps/settings/src/store/users.js | 3 |
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 |