Skip to content

Commit 1b7418f

Browse files
committed
fix(files_versions): ensure users IDs are strings
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
1 parent 5a73733 commit 1b7418f

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

apps/files_versions/src/utils/versions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ export async function fetchVersions(fileInfo: any): Promise<Version[]> {
5050
.filter(({ mime }) => mime !== '')
5151
.map(version => formatVersion(version, fileInfo))
5252

53-
const authorIds = new Set(versions.map(version => version.author))
53+
const authorIds = new Set(versions.map(version => String(version.author)))
5454
const authors = await axios.post(generateUrl('/displaynames'), { users: [...authorIds] })
5555

5656
for (const version of versions) {
57-
const author = authors.data.users[version.author]
57+
const author = authors.data.users[version.author ?? '']
5858
if (author) {
5959
version.authorName = author
6060
}
@@ -106,7 +106,7 @@ function formatVersion(version: any, fileInfo: any): Version {
106106
fileId: fileInfo.id,
107107
// If version-label is defined make sure it is a string (prevent issue if the label is a number an PHP returns a number then)
108108
label: version.props['version-label'] && String(version.props['version-label']),
109-
author: version.props['version-author'] ?? null,
109+
author: String(version.props['version-author']) ?? null,
110110
authorName: null,
111111
filename: version.filename,
112112
basename: moment(mtime).format('LLL'),

0 commit comments

Comments
 (0)