Skip to content

Commit

Permalink
fix: Fix error when viewing current version
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Knorr <jus@bitgrid.net>
  • Loading branch information
juliushaertl committed Oct 10, 2024
1 parent c51858a commit a713b80
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/utils/canDownload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type { FileInfo } from './fileUtils'
export function canDownload(fileInfo: FileInfo) {
// TODO: This should probably be part of `@nextcloud/sharing`
// check share attributes
const shareAttributes = JSON.parse(fileInfo.shareAttributes || '[]')
const shareAttributes = typeof fileInfo?.shareAttributes === 'string' ? JSON.parse(fileInfo.shareAttributes || '[]') : fileInfo?.shareAttributes

if (shareAttributes && shareAttributes.length > 0) {
const downloadAttribute = shareAttributes.find(({ scope, key }) => scope === 'permissions' && key === 'download')
Expand Down
2 changes: 1 addition & 1 deletion src/utils/fileUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export interface FileInfo {
/** File type */
type: 'directory'|'file'
/** Attributes for file shares */
shareAttributes?: string
shareAttributes?: string|Array<{value:any, key: string, scope: string}>

Check failure on line 36 in src/utils/fileUtils.ts

View workflow job for this annotation

GitHub Actions / NPM lint

Unexpected any. Specify a different type

// custom attributes not fetch from API

Expand Down

0 comments on commit a713b80

Please sign in to comment.