File tree Expand file tree Collapse file tree
apps/files_versions/src/utils Expand file tree Collapse file tree Original file line number Diff line number Diff 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' ) ,
You can’t perform that action at this time.
0 commit comments