handle thumbnails length 0

This commit is contained in:
myl7 2022-02-09 16:16:13 +08:00
parent 197336d42d
commit 9b03d97d2c
No known key found for this signature in database
GPG key ID: 04F1013B67177C88

View file

@ -17,11 +17,9 @@ const GridItem = ({ c, path }: { c: OdFolderChildren; path: string }) => {
'folder' in c
? // Folders don't have thumbnails
null
: c.thumbnails
: c.thumbnails && c.thumbnails.length > 0
? // Most OneDrive versions, including E5 developer, should have thumbnails returned
c.thumbnails.length > 0
? c.thumbnails[0].medium.url
: null
c.thumbnails[0].medium.url
: // According to OneDrive docs, OneDrive for Business and SharePoint does not
// (can not retrieve thumbnails via expand). But currently we only see OneDrive 世纪互联 really does not.
`/api/thumbnail?path=${path}`