Skip to content

Commit

Permalink
Ignore existing folder errors for now
Browse files Browse the repository at this point in the history
  • Loading branch information
lookacat committed Sep 6, 2022
1 parent dc7615d commit 238bcd5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ export default defineComponent({
async handleUppyFileUpload(files: UppyResource[]) {
this.$uppyService.publish('uploadStarted')
await this.createDirectoryTree(files, this.files)
await this.createDirectoryTree(files)
this.$uppyService.publish('addedForUpload', files)
this.$uppyService.uploadFiles(files)
},
Expand Down
8 changes: 5 additions & 3 deletions packages/web-runtime/src/composables/upload/useUpload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ interface UploadOptions {
}

interface UploadResult {
createDirectoryTree(files: UppyResource[], existingFiles: Resource[]): void
createDirectoryTree(files: UppyResource[]): void
}

export function useUpload(options: UploadOptions): UploadResult {
Expand Down Expand Up @@ -122,7 +122,7 @@ const createDirectoryTree = ({
publicLinkPassword?: Ref<string>
uppyService: UppyService
}) => {
return async (files: UppyResource[], existingFiles: Resource[]) => {
return async (files: UppyResource[]) => {
const { owncloudSdk: client } = clientService
const createdFolders = []
for (const file of files) {
Expand Down Expand Up @@ -182,8 +182,10 @@ const createDirectoryTree = ({
unref(publicLinkPassword)
)
} else {
if (!existingFiles.some((f) => f.path === folderToCreate)) {
try {
await client.files.createFolder(`${file.meta.webDavBasePath}/${folderToCreate}`)
}catch(error){
console.log(error)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('useUpload', () => {
}
]

await wrapper.vm.createDirectoryTree(uppyResources, [])
await wrapper.vm.createDirectoryTree(uppyResources)
expect(createFolderMock).toHaveBeenCalledTimes(4)
})
})

0 comments on commit 238bcd5

Please sign in to comment.