Skip to content

Commit

Permalink
Merge pull request #1369 from nextcloud-libraries/fix/destination-val…
Browse files Browse the repository at this point in the history
…idation

fix(uploader): validation of the destination should not compare the class
  • Loading branch information
susnux authored Sep 4, 2024
2 parents 6708f9c + f10e078 commit 438876f
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 438876f

Please sign in to comment.