|
|
@ -121,14 +121,13 @@ import type { Upload } from '@nextcloud/upload' |
|
|
|
import type { UserConfig } from '../types.ts' |
|
|
|
import type { UserConfig } from '../types.ts' |
|
|
|
import type { View, ContentsWithRoot } from '@nextcloud/files' |
|
|
|
import type { View, ContentsWithRoot } from '@nextcloud/files' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import { getCapabilities } from '@nextcloud/capabilities' |
|
|
|
import { emit, subscribe, unsubscribe } from '@nextcloud/event-bus' |
|
|
|
import { emit, subscribe, unsubscribe } from '@nextcloud/event-bus' |
|
|
|
import { Folder, Node, Permission } from '@nextcloud/files' |
|
|
|
import { Folder, Node, Permission } from '@nextcloud/files' |
|
|
|
import { getCapabilities } from '@nextcloud/capabilities' |
|
|
|
import { translate as t } from '@nextcloud/l10n' |
|
|
|
import { join, dirname } from 'path' |
|
|
|
import { join, dirname } from 'path' |
|
|
|
import { orderBy } from 'natural-orderby' |
|
|
|
import { orderBy } from 'natural-orderby' |
|
|
|
import { Parser } from 'xml2js' |
|
|
|
|
|
|
|
import { showError } from '@nextcloud/dialogs' |
|
|
|
import { showError } from '@nextcloud/dialogs' |
|
|
|
import { translate, translatePlural } from '@nextcloud/l10n' |
|
|
|
|
|
|
|
import { Type } from '@nextcloud/sharing' |
|
|
|
import { Type } from '@nextcloud/sharing' |
|
|
|
import { UploadPicker } from '@nextcloud/upload' |
|
|
|
import { UploadPicker } from '@nextcloud/upload' |
|
|
|
import { loadState } from '@nextcloud/initial-state' |
|
|
|
import { loadState } from '@nextcloud/initial-state' |
|
|
@ -469,6 +468,8 @@ export default defineComponent({ |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
|
|
|
|
t, |
|
|
|
|
|
|
|
|
|
|
|
async fetchContent() { |
|
|
|
async fetchContent() { |
|
|
|
this.loading = true |
|
|
|
this.loading = true |
|
|
|
const dir = this.dir |
|
|
|
const dir = this.dir |
|
|
@ -569,17 +570,19 @@ export default defineComponent({ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Else we try to parse the response error message |
|
|
|
// Else we try to parse the response error message |
|
|
|
try { |
|
|
|
if (typeof upload.response?.data === 'string') { |
|
|
|
const parser = new Parser({ trim: true, explicitRoot: false }) |
|
|
|
try { |
|
|
|
const response = await parser.parseStringPromise(upload.response?.data) |
|
|
|
const parser = new DOMParser() |
|
|
|
const message = response['s:message'][0] as string |
|
|
|
const doc = parser.parseFromString(upload.response.data, 'text/xml') |
|
|
|
if (typeof message === 'string' && message.trim() !== '') { |
|
|
|
const message = doc.getElementsByTagName('s:message')[0]?.textContent ?? '' |
|
|
|
// The server message is also translated |
|
|
|
if (message.trim() !== '') { |
|
|
|
showError(this.t('files', 'Error during upload: {message}', { message })) |
|
|
|
// The server message is also translated |
|
|
|
return |
|
|
|
showError(t('files', 'Error during upload: {message}', { message })) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
|
|
logger.error('Could not parse message', { error }) |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
|
|
|
|
logger.error('Error while parsing', { error }) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Finally, check the status code if we have one |
|
|
|
// Finally, check the status code if we have one |
|
|
@ -632,9 +635,6 @@ export default defineComponent({ |
|
|
|
toggleGridView() { |
|
|
|
toggleGridView() { |
|
|
|
this.userConfigStore.update('grid_view', !this.userConfig.grid_view) |
|
|
|
this.userConfigStore.update('grid_view', !this.userConfig.grid_view) |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
t: translate, |
|
|
|
|
|
|
|
n: translatePlural, |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
}) |
|
|
|
}) |
|
|
|
</script> |
|
|
|
</script> |
|
|
|