Skip to content

Commit 82fce12

Browse files
authored
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
2 parents 48ea4da + 00c26fc commit 82fce12

File tree

76 files changed

+230
-243
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+230
-243
lines changed

apps/settings/src/components/UserList.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ import Vue from 'vue'
262262
import NcModal from '@nextcloud/vue/dist/Components/NcModal.js'
263263
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
264264
import NcMultiselect from '@nextcloud/vue/dist/Components/NcMultiselect.js'
265+
import { formatFileSize, parseFileSize } from '@nextcloud/files'
265266
266267
import userRow from './UserList/UserRow.vue'
267268
@@ -486,10 +487,10 @@ export default {
486487
*/
487488
validateQuota(quota) {
488489
// only used for new presets sent through @Tag
489-
const validQuota = OC.Util.computerFileSize(quota)
490+
const validQuota = parseFileSize(quota, true)
490491
if (validQuota !== null && validQuota >= 0) {
491492
// unify format output
492-
quota = OC.Util.humanFileSize(OC.Util.computerFileSize(quota))
493+
quota = formatFileSize(parseFileSize(quota, true))
493494
this.newUser.quota = { id: quota, label: quota }
494495
return this.newUser.quota
495496
}

apps/settings/src/components/UserList/UserRow.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@
268268

269269
<script>
270270
import ClickOutside from 'vue-click-outside'
271+
import { formatFileSize, parseFileSize } from '@nextcloud/files'
271272
272273
import {
273274
NcPopoverMenu,
@@ -688,7 +689,7 @@ export default {
688689
await this.$store.dispatch('setUserData', {
689690
userid: this.user.id,
690691
key: 'quota',
691-
value: quota,
692+
value: '' + parseFileSize(quota, true),
692693
})
693694
} catch (error) {
694695
console.error(error)
@@ -706,10 +707,10 @@ export default {
706707
*/
707708
validateQuota(quota) {
708709
// only used for new presets sent through @Tag
709-
const validQuota = OC.Util.computerFileSize(quota)
710+
const validQuota = parseFileSize(quota, true)
710711
if (validQuota !== null && validQuota >= 0) {
711712
// unify format output
712-
return this.setUserQuota(OC.Util.humanFileSize(OC.Util.computerFileSize(quota)))
713+
return this.setUserQuota(formatFileSize(parseFileSize(quota, true)))
713714
}
714715
// if no valid do not change
715716
return false

apps/settings/src/store/users.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import api from './api.js'
3131
import axios from '@nextcloud/axios'
3232
import { generateOcsUrl } from '@nextcloud/router'
3333
import logger from '../logger.js'
34+
import { parseFileSize } from '@nextcloud/files'
3435

3536
const orderGroups = function(groups, orderBy) {
3637
/* const SORT_USERCOUNT = 1;
@@ -211,7 +212,7 @@ const mutations = {
211212
},
212213
setUserData(state, { userid, key, value }) {
213214
if (key === 'quota') {
214-
const humanValue = OC.Util.computerFileSize(value)
215+
const humanValue = parseFileSize(value, true)
215216
state.users.find(user => user.id === userid)[key][key] = humanValue !== null ? humanValue : value
216217
} else {
217218
state.users.find(user => user.id === userid)[key] = value

core/src/components/UserMenu/UserMenuEntry.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@
3030
<NcLoadingIcon v-if="loading"
3131
class="menu-entry__loading-icon"
3232
:size="18" />
33-
<img v-else :src="cachedIcon" alt="" />
33+
<img v-else :src="cachedIcon" alt="">
3434
{{ name }}
3535
</a>
3636
<button v-else>
37-
<img :src="cachedIcon" alt="" />
37+
<img :src="cachedIcon" alt="">
3838
{{ name }}
3939
</button>
4040
</li>

dist/6799-6799.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/comments-comments-app.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/comments-comments-app.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/core-common.js

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

dist/core-common.js.LICENSE.txt

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -473,8 +473,6 @@ object-assign
473473
* Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-patch.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js
474474
* Copyright jQuery Foundation and other contributors; Licensed MIT */
475475

476-
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
477-
478476
/**
479477
*
480478
*
@@ -483,28 +481,6 @@ object-assign
483481
*
484482
*/
485483

486-
/**
487-
* @copyright 2019 Christoph Wurst <[email protected]>
488-
*
489-
* @author Christoph Wurst <[email protected]>
490-
*
491-
* @license AGPL-3.0-or-later
492-
*
493-
* This program is free software: you can redistribute it and/or modify
494-
* it under the terms of the GNU Affero General Public License as
495-
* published by the Free Software Foundation, either version 3 of the
496-
* License, or (at your option) any later version.
497-
*
498-
* This program is distributed in the hope that it will be useful,
499-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
500-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
501-
* GNU Affero General Public License for more details.
502-
*
503-
* You should have received a copy of the GNU Affero General Public License
504-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
505-
*
506-
*/
507-
508484
/**
509485
* @copyright 2019 Christoph Wurst <[email protected]>
510486
*
@@ -884,7 +860,7 @@ object-assign
884860
*/
885861

886862
/**
887-
* @copyright Copyright (c) 2021 John Molakvoæ <[email protected]>
863+
* @copyright Copyright (c) 2022 John Molakvoæ <[email protected]>
888864
*
889865
* @author John Molakvoæ <[email protected]>
890866
*
@@ -906,9 +882,9 @@ object-assign
906882
*/
907883

908884
/**
909-
* @copyright Copyright (c) 2022 John Molakvoæ <[email protected]>
885+
* @copyright Copyright (c) 2023 Ferdinand Thiessen <[email protected]>
910886
*
911-
* @author John Molakvoæ <[email protected]>
887+
* @author Ferdinand Thiessen <[email protected]>
912888
*
913889
* @license AGPL-3.0-or-later
914890
*
@@ -946,7 +922,6 @@ object-assign
946922
*
947923
* You should have received a copy of the GNU Affero General Public License
948924
* along with this program. If not, see <http://www.gnu.org/licenses/>.
949-
*
950925
*/
951926

952927
/**
@@ -963,17 +938,19 @@ object-assign
963938
*
964939
* This program is distributed in the hope that it will be useful,
965940
* but WITHOUT ANY WARRANTY; without even the implied warranty of
966-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
941+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
967942
* GNU Affero General Public License for more details.
968943
*
969944
* You should have received a copy of the GNU Affero General Public License
970945
* along with this program. If not, see <http://www.gnu.org/licenses/>.
946+
*
971947
*/
972948

973949
/**
974950
* @copyright Copyright (c) 2023 Ferdinand Thiessen <[email protected]>
975951
*
976952
* @author Ferdinand Thiessen <[email protected]>
953+
* @author John Molakvoæ <[email protected]>
977954
*
978955
* @license AGPL-3.0-or-later
979956
*
@@ -993,9 +970,8 @@ object-assign
993970
*/
994971

995972
/**
996-
* @copyright Copyright (c) 2023 Ferdinand Thiessen <[email protected]>
973+
* @copyright Copyright (c) 2023 John Molakvoæ <[email protected]>
997974
*
998-
* @author Ferdinand Thiessen <[email protected]>
999975
* @author John Molakvoæ <[email protected]>
1000976
*
1001977
* @license AGPL-3.0-or-later
@@ -1007,7 +983,30 @@ object-assign
1007983
*
1008984
* This program is distributed in the hope that it will be useful,
1009985
* but WITHOUT ANY WARRANTY; without even the implied warranty of
1010-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
986+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
987+
* GNU Affero General Public License for more details.
988+
*
989+
* You should have received a copy of the GNU Affero General Public License
990+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
991+
*
992+
*/
993+
994+
/**
995+
* @copyright Copyright (c) 2023 John Molakvoæ <[email protected]>
996+
*
997+
* @author John Molakvoæ <[email protected]>
998+
* @author Ferdinand Thiessen <[email protected]>
999+
*
1000+
* @license AGPL-3.0-or-later
1001+
*
1002+
* This program is free software: you can redistribute it and/or modify
1003+
* it under the terms of the GNU Affero General Public License as
1004+
* published by the Free Software Foundation, either version 3 of the
1005+
* License, or (at your option) any later version.
1006+
*
1007+
* This program is distributed in the hope that it will be useful,
1008+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
1009+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10111010
* GNU Affero General Public License for more details.
10121011
*
10131012
* You should have received a copy of the GNU Affero General Public License

dist/core-common.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)