Skip to content

Commit

Permalink
Fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
dschmidt committed Feb 20, 2022
1 parent ac8bfac commit 6c36514
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,24 @@ describe('isSameResource', () => {
expect(isSameResource({ id: 1, path: '', webDavPath: '' }, undefined)).toBe(false)
})
test('evaluates to false if ids are of different types', () => {
expect(isSameResource({ id: 1, path: '', webDavPath: '' }, { id: '1', path: '', webDavPath: '' })).toBe(false)
expect(
isSameResource({ id: 1, path: '', webDavPath: '' }, { id: '1', path: '', webDavPath: '' })
).toBe(false)
})
test('evaluates to false if ids are different values', () => {
expect(isSameResource({ id: 1, path: '', webDavPath: '' }, { id: 2, path: '', webDavPath: '' })).toBe(false)
expect(isSameResource({ id: '1', path: '', webDavPath: '' }, { id: '2', path: '', webDavPath: '' })).toBe(false)
expect(
isSameResource({ id: 1, path: '', webDavPath: '' }, { id: 2, path: '', webDavPath: '' })
).toBe(false)
expect(
isSameResource({ id: '1', path: '', webDavPath: '' }, { id: '2', path: '', webDavPath: '' })
).toBe(false)
})
test('evaluates to true if ids are the same', () => {
expect(isSameResource({ id: 1, path: '', webDavPath: '' }, { id: 1, path: '', webDavPath: '' })).toBe(true)
expect(isSameResource({ id: '1', path: '', webDavPath: '' }, { id: '1', path: '', webDavPath: '' })).toBe(true)
expect(
isSameResource({ id: 1, path: '', webDavPath: '' }, { id: 1, path: '', webDavPath: '' })
).toBe(true)
expect(
isSameResource({ id: '1', path: '', webDavPath: '' }, { id: '1', path: '', webDavPath: '' })
).toBe(true)
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,17 @@ export function useAppFileHandling(options: AppFileHandlingOptions): AppFileHand
const isPublicLinkContext = options.isPublicLinkContext
const publicLinkPassword = options.publicLinkPassword

const getUrlForResource = ({ webDavPath, downloadURL }: Resource, query: QueryParameters = null) => {
const getUrlForResource = (
{ webDavPath, downloadURL }: Resource,
query: QueryParameters = null
) => {
const queryStr = qs.stringify(query)
if (unref(isPublicLinkContext)) {
// If the resource does not contain the downloadURL we fallback to the normal
// public files path.
if (!downloadURL) {
// TODO: check whether we can fix the resource to always contain public-files in the webDavPath
let urlPath = ['public-files', webDavPath].join('/')
const urlPath = ['public-files', webDavPath].join('/')
return [client.files.getFileUrl(urlPath), queryStr].filter(Boolean).join('?')
}

Expand Down

0 comments on commit 6c36514

Please sign in to comment.