mirror of
https://github.com/nextcloud/server.git
synced 2026-06-14 19:20:35 -04:00
fix(files_versions): ensure author and label are string
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
This commit is contained in:
parent
84a01c683c
commit
0d50ef23f7
1 changed files with 4 additions and 4 deletions
|
|
@ -50,11 +50,11 @@ export async function fetchVersions(fileInfo: any): Promise<Version[]> {
|
|||
.filter(({ mime }) => mime !== '')
|
||||
.map(version => formatVersion(version, fileInfo))
|
||||
|
||||
const authorIds = new Set(versions.map(version => version.author))
|
||||
const authorIds = new Set(versions.map(version => String(version.author)))
|
||||
const authors = await axios.post(generateUrl('/displaynames'), { users: [...authorIds] })
|
||||
|
||||
for (const version of versions) {
|
||||
const author = authors.data.users[version.author]
|
||||
const author = authors.data.users[version.author ?? '']
|
||||
if (author) {
|
||||
version.authorName = author
|
||||
}
|
||||
|
|
@ -105,8 +105,8 @@ function formatVersion(version: any, fileInfo: any): Version {
|
|||
return {
|
||||
fileId: fileInfo.id,
|
||||
// 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)
|
||||
label: version.props['version-label'] && String(version.props['version-label']),
|
||||
author: version.props['version-author'] ?? null,
|
||||
label: version.props['version-label'] ? String(version.props['version-label']) : '',
|
||||
author: version.props['version-author'] ? String(version.props['version-author']) : null,
|
||||
authorName: null,
|
||||
filename: version.filename,
|
||||
basename: moment(mtime).format('LLL'),
|
||||
|
|
|
|||
Loading…
Reference in a new issue