Skip to content

Commit

Permalink
fix(uploader): validation of the destination should not compare the c…
Browse files Browse the repository at this point in the history
…lass

This some how breaks when used with Vue 2, maybe the prototype is not set correctly,
but with the current files app this breaks.
So instead just validate the type if folder and a source is set (we only use the source).

Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux committed Sep 4, 2024
1 parent 0146ba9 commit f10e078
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/uploader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { WebDAVClient } from 'webdav'
import type { IDirectory } from './utils/fileTree'

import { getCurrentUser } from '@nextcloud/auth'
import { Folder, Permission, davGetClient, davRemoteURL, davRootPath } from '@nextcloud/files'
import { FileType, Folder, Permission, davGetClient, davRemoteURL, davRootPath } from '@nextcloud/files'
import { encodePath } from '@nextcloud/paths'
import { normalize } from 'path'

Expand Down Expand Up @@ -107,7 +107,7 @@ export class Uploader {
* Set the upload destination path relative to the root folder
*/
set destination(folder: Folder) {
if (!folder || !(folder instanceof Folder)) {
if (!folder || folder.type !== FileType.Folder || !folder.source) {
throw new Error('Invalid destination folder')
}

Expand Down

0 comments on commit f10e078

Please sign in to comment.