Skip to content

Commit c2d5a60

Browse files
authored
Merge pull request #40787 from nextcloud/fix/stable27-wrong-quota-files-app
2 parents 8a162ee + acdc319 commit c2d5a60

File tree

6 files changed

+23
-20
lines changed

6 files changed

+23
-20
lines changed

apps/files/src/components/FileEntry.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ export default Vue.extend({
261261
if (typeof size !== 'number' || size < 0) {
262262
return this.t('files', 'Pending')
263263
}
264-
return formatFileSize(size, true)
264+
return formatFileSize(size, true, true).replace('iB', 'B')
265265
},
266266
sizeOpacity() {
267267
const size = parseInt(this.source.size, 10) || 0

apps/files/src/components/FilesListFooter.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,11 @@ export default Vue.extend({
127127
totalSize() {
128128
// If we have the size already, let's use it
129129
if (this.currentFolder?.size) {
130-
return formatFileSize(this.currentFolder.size, true)
130+
return formatFileSize(this.currentFolder.size, true, true).replace('iB', 'B')
131131
}
132132
133133
// Otherwise let's compute it
134-
return formatFileSize(this.nodes.reduce((total, node) => total + node.size || 0, 0), true)
134+
return formatFileSize(this.nodes.reduce((total, node) => total + node.size || 0, 0), true, true).replace('iB', 'B')
135135
},
136136
},
137137

apps/files/src/components/NavigationQuota.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ export default {
5151
5252
computed: {
5353
storageStatsTitle() {
54-
const usedQuotaByte = formatFileSize(this.storageStats?.used)
55-
const quotaByte = formatFileSize(this.storageStats?.quota)
54+
const usedQuotaByte = formatFileSize(this.storageStats?.used, false, true).replace('iB', 'B')
55+
const quotaByte = formatFileSize(this.storageStats?.quota, false, true).replace('iB', 'B')
5656
5757
// If no quota set
5858
if (this.storageStats?.quota < 0) {

apps/files/src/views/Navigation.cy.ts

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
import * as InitialState from '@nextcloud/initial-state'
22
import * as L10n from '@nextcloud/l10n'
3-
import FolderSvg from '@mdi/svg/svg/folder.svg'
4-
import ShareSvg from '@mdi/svg/svg/share-variant.svg'
3+
// eslint-disable-next-line import/no-unresolved
4+
import FolderSvg from '@mdi/svg/svg/folder.svg?raw'
5+
// eslint-disable-next-line import/no-unresolved
6+
import ShareSvg from '@mdi/svg/svg/share-variant.svg?raw'
57
import { createTestingPinia } from '@pinia/testing'
68

7-
import NavigationService from '../services/Navigation.ts'
9+
import NavigationService from '../services/Navigation'
810
import NavigationView from './Navigation.vue'
911
import router from '../router/router.js'
1012
import { useViewConfigStore } from '../store/viewConfig'
13+
import { Folder } from '@nextcloud/files'
1114

1215
describe('Navigation renders', () => {
1316
const Navigation = new NavigationService() as NavigationService
1417

1518
before(() => {
1619
cy.stub(InitialState, 'loadState')
1720
.returns({
18-
used: 1000 * 1000 * 1000,
21+
used: 1024 * 1024 * 1024,
1922
quota: -1,
2023
})
2124
})
@@ -72,7 +75,7 @@ describe('Navigation API', () => {
7275
Navigation.register({
7376
id: 'sharing',
7477
name: 'Sharing',
75-
getContents: () => Promise.resolve(),
78+
getContents: () => Promise.resolve({ contents: [], folder: new Folder({ owner: 'admin', source: 'source' }) }),
7679
icon: ShareSvg,
7780
order: 2,
7881
})
@@ -99,7 +102,7 @@ describe('Navigation API', () => {
99102
Navigation.register({
100103
id: 'sharingin',
101104
name: 'Shared with me',
102-
getContents: () => Promise.resolve(),
105+
getContents: () => Promise.resolve({ contents: [], folder: new Folder({ owner: 'admin', source: 'source' }) }),
103106
parent: 'sharing',
104107
icon: ShareSvg,
105108
order: 1,
@@ -146,7 +149,7 @@ describe('Navigation API', () => {
146149
Navigation.register({
147150
id: 'files',
148151
name: 'Files',
149-
getContents: () => Promise.resolve(),
152+
getContents: () => Promise.resolve({ contents: [], folder: new Folder({ owner: 'admin', source: 'source' }) }),
150153
icon: FolderSvg,
151154
order: 1,
152155
})
@@ -191,7 +194,7 @@ describe('Quota rendering', () => {
191194
cy.stub(InitialState, 'loadState')
192195
.as('loadStateStats')
193196
.returns({
194-
used: 1000 * 1000 * 1000,
197+
used: 1024 * 1024 * 1024,
195198
quota: -1,
196199
})
197200

@@ -215,8 +218,8 @@ describe('Quota rendering', () => {
215218
cy.stub(InitialState, 'loadState')
216219
.as('loadStateStats')
217220
.returns({
218-
used: 1000 * 1000 * 1000,
219-
quota: 5 * 1000 * 1000 * 1000,
221+
used: 1024 * 1024 * 1024,
222+
quota: 5 * 1024 * 1024 * 1024,
220223
relative: 20, // percent
221224
})
222225

@@ -241,8 +244,8 @@ describe('Quota rendering', () => {
241244
cy.stub(InitialState, 'loadState')
242245
.as('loadStateStats')
243246
.returns({
244-
used: 5 * 1000 * 1000 * 1000,
245-
quota: 1000 * 1000 * 1000,
247+
used: 5 * 1024 * 1024 * 1024,
248+
quota: 1024 * 1024 * 1024,
246249
relative: 500, // percent
247250
})
248251

dist/files-main.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/files-main.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)