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 c040bdd
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 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
4 changes: 2 additions & 2 deletions packages/web-app-files/src/helpers/resource/copyMove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const resolveFileExists = (
$gettext,
$gettextInterpolate,
isSingleConflict,
suggestMerge=false
suggestMerge = false
): Promise<ResolveConflict> => {
return new Promise<ResolveConflict>((resolve) => {
let doForAllConflicts = false
Expand All @@ -43,7 +43,7 @@ export const resolveFileExists = (
true
),
cancelText: $gettext('Skip'),
confirmText: $gettext('Keep both') ,
confirmText: $gettext('Keep both'),
buttonSecondaryText: suggestMerge ? $gettext('Merge') : $gettext('Replace'),
checkboxLabel: isSingleConflict
? ''
Expand Down
9 changes: 5 additions & 4 deletions packages/web-runtime/src/composables/upload/useUpload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
import { computed, Ref, unref, watch } from '@vue/composition-api'
import { UppyService } from '../../services/uppyService'
import * as uuid from 'uuid'
import { Resource } from 'web-client/src/helpers/resource'

export interface UppyResource {
id?: string
Expand Down Expand Up @@ -44,7 +43,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 +121,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 +181,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 c040bdd

Please sign in to comment.