Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/dav/src/components/AbsenceForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export default {
ShareType.User,
]

let request = null
let request
try {
request = await axios.get(generateOcsUrl('apps/files_sharing/api/v1/sharees'), {
params: {
Expand Down
3 changes: 1 addition & 2 deletions apps/files/src/components/FilesListVirtual.vue
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,7 @@ export default defineComponent({
}

if (event.key !== 'ArrowUp' && event.key !== 'ArrowDown'
&& (!this.userConfig.grid_view || (event.key !== 'ArrowLeft' && event.key !== 'ArrowRight'))
) {
&& (!this.userConfig.grid_view || (event.key !== 'ArrowLeft' && event.key !== 'ArrowRight'))) {
// not an arrow key we handle
return
}
Expand Down
2 changes: 1 addition & 1 deletion apps/files/src/components/FilesNavigationListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export default {
allow-collapse
:loading="isLoading"
:data-cy-files-navigation-item="view.id"
:exact="hasChildViews /* eslint-disable-line @nextcloud/vue/no-deprecated-props */"
:exact="hasChildViews"
:name="view.name"
:open="isExpanded"
:pinned="view.sticky"
Expand Down
3 changes: 1 addition & 2 deletions apps/files/src/composables/usePreviewImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ export function usePreviewImage(
const fallback = toValue(options).fallback ?? true
if (source.attributes['has-preview'] !== true
&& source.mime !== undefined
&& source.mime !== 'application/octet-stream'
) {
&& source.mime !== 'application/octet-stream') {
if (!fallback) {
return
}
Expand Down
12 changes: 5 additions & 7 deletions apps/files/src/store/renaming.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ export const useRenamingStore = defineStore('renaming', () => {
// Check for extension change for files
if (node.type === FileType.File
&& oldExtension !== newExtension
&& !(await showFileExtensionDialog(oldExtension, newExtension))
) {
&& !(await showFileExtensionDialog(oldExtension, newExtension))) {
// user selected to use the old extension
newName = basename(newName, newExtension) + oldExtension
if (oldName === newName) {
Expand All @@ -78,8 +77,7 @@ export const useRenamingStore = defineStore('renaming', () => {
if (!userConfig.userConfig.show_hidden
&& newName.startsWith('.')
&& !oldName.startsWith('.')
&& !(await showHiddenFileDialog(newName))
) {
&& !(await showHiddenFileDialog(newName))) {
return false
}
}
Expand Down Expand Up @@ -126,7 +124,7 @@ export const useRenamingStore = defineStore('renaming', () => {
if (isAxiosError(error)) {
// TODO: 409 means current folder does not exist, redirect ?
if (error?.response?.status === 404) {
throw new Error(t('files', 'Could not rename "{oldName}", it does not exist any more', { oldName }))
throw new Error(t('files', 'Could not rename "{oldName}", it does not exist any more', { oldName }), { cause: error })
} else if (error?.response?.status === 412) {
throw new Error(t(
'files',
Expand All @@ -135,11 +133,11 @@ export const useRenamingStore = defineStore('renaming', () => {
newName,
dir: basename(renamingNode.value!.dirname),
},
))
), { cause: error })
}
}
// Unknown error
throw new Error(t('files', 'Could not rename "{oldName}"', { oldName }))
throw new Error(t('files', 'Could not rename "{oldName}"', { oldName }), { cause: error })
} finally {
Vue.set(node, 'status', undefined)
isRenaming.value = false
Expand Down
3 changes: 1 addition & 2 deletions apps/files/src/utils/permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ export function isDownloadable(node: INode): boolean {

// check hide-download property of shares
if (node.attributes['hide-download'] === true
|| node.attributes['hide-download'] === 'true'
) {
|| node.attributes['hide-download'] === 'true') {
return false
}

Expand Down
4 changes: 2 additions & 2 deletions apps/files_sharing/src/components/SharingInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export default {
shareType.push(...remoteTypes)
}

let request = null
let request
try {
request = await axios.get(generateOcsUrl('apps/files_sharing/api/v1/sharees'), {
params: {
Expand Down Expand Up @@ -321,7 +321,7 @@ export default {
async getRecommendations() {
this.loading = true

let request = null
let request
try {
request = await axios.get(generateOcsUrl('apps/files_sharing/api/v1/sharees_recommended'), {
params: {
Expand Down
2 changes: 1 addition & 1 deletion apps/files_sharing/src/mixins/ShareDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import logger from '../services/logger.ts'
export default {
methods: {
async openSharingDetails(shareRequestObject) {
let share = {}
let share
// handle externalResults from OCA.Sharing.ShareSearch
// TODO : Better name/interface for handler required
// For example `externalAppCreateShareHook` with proper documentation
Expand Down
6 changes: 3 additions & 3 deletions apps/files_versions/src/utils/versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ export async function restoreVersion(version: Version) {
*/
function formatVersion(version: Required<FileStat>, node: INode): Version {
const mtime = Date.parse(version.lastmod)
let previewUrl = ''

let previewUrl: string
if (mtime === node.mtime?.getTime()) { // Version is the current one
previewUrl = generateUrl('/core/preview?fileId={fileId}&c={fileEtag}&x=250&y=250&forceIcon=0&a=0&forceIcon=1&mimeFallback=1', {
fileId: node.fileid,
fileId: node.id,
fileEtag: node.attributes.etag,
})
} else {
Expand All @@ -113,7 +113,7 @@ function formatVersion(version: Required<FileStat>, node: INode): Version {
}

return {
fileId: node.fileid!.toString(),
fileId: node.id!,
// If version-label is defined make sure it is a string (prevent issue if the label is a number an PHP returns a number then)
label: version.props['version-label'] ? String(version.props['version-label']) : '',
author: version.props['version-author'] ? String(version.props['version-author']) : null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export default {
this.$emit('added', device)
} catch (err) {
logger.error('Error persisting webauthn registration', { error: err })
throw new Error(t('settings', 'Server error while trying to complete WebAuthn device registration'))
throw new Error(t('settings', 'Server error while trying to complete WebAuthn device registration'), { cause: err })
}
},

Expand Down
6 changes: 3 additions & 3 deletions apps/settings/src/service/WebAuthnRegistrationSerice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ export async function startRegistration() {
} catch (e) {
logger.error(e as Error)
if (isAxiosError(e)) {
throw new Error(t('settings', 'Could not register device: Network error'))
throw new Error(t('settings', 'Could not register device: Network error'), { cause: e })
} else if ((e as Error).name === 'InvalidStateError') {
throw new Error(t('settings', 'Could not register device: Probably already registered'))
throw new Error(t('settings', 'Could not register device: Probably already registered'), { cause: e })
}
throw new Error(t('settings', 'Could not register device'))
throw new Error(t('settings', 'Could not register device'), { cause: e })
}
}

Expand Down
14 changes: 7 additions & 7 deletions apps/systemtags/src/services/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export async function fetchTags(): Promise<TagWithId[]> {
return parseTags(tags)
} catch (error) {
logger.error(t('systemtags', 'Failed to load tags'), { error })
throw new Error(t('systemtags', 'Failed to load tags'))
throw new Error(t('systemtags', 'Failed to load tags'), { cause: error })
}
}

Expand All @@ -62,7 +62,7 @@ export async function fetchTag(tagId: number): Promise<TagWithId> {
return parseTags([tag])[0]!
} catch (error) {
logger.error(t('systemtags', 'Failed to load tag'), { error })
throw new Error(t('systemtags', 'Failed to load tag'))
throw new Error(t('systemtags', 'Failed to load tag'), { cause: error })
}
}

Expand All @@ -76,7 +76,7 @@ export async function fetchLastUsedTagIds(): Promise<number[]> {
return lastUsedTagIds.map(Number)
} catch (error) {
logger.error(t('systemtags', 'Failed to load last used tags'), { error })
throw new Error(t('systemtags', 'Failed to load last used tags'))
throw new Error(t('systemtags', 'Failed to load last used tags'), { cause: error })
}
}

Expand All @@ -103,10 +103,10 @@ export async function createTag(tag: Tag | ServerTag): Promise<number> {
} catch (error) {
if ((error as WebDAVClientError)?.response?.status === 409) {
logger.error(t('systemtags', 'A tag with the same name already exists'), { error })
throw new Error(t('systemtags', 'A tag with the same name already exists'))
throw new Error(t('systemtags', 'A tag with the same name already exists'), { cause: error })
}
logger.error(t('systemtags', 'Failed to create tag'), { error })
throw new Error(t('systemtags', 'Failed to create tag'))
throw new Error(t('systemtags', 'Failed to create tag'), { cause: error })
}
}

Expand Down Expand Up @@ -137,7 +137,7 @@ export async function updateTag(tag: TagWithId): Promise<void> {
emit('systemtags:tag:updated', tag)
} catch (error) {
logger.error(t('systemtags', 'Failed to update tag'), { error })
throw new Error(t('systemtags', 'Failed to update tag'))
throw new Error(t('systemtags', 'Failed to update tag'), { cause: error })
}
}

Expand All @@ -153,7 +153,7 @@ export async function deleteTag(tag: TagWithId): Promise<void> {
emit('systemtags:tag:deleted', tag)
} catch (error) {
logger.error(t('systemtags', 'Failed to delete tag'), { error })
throw new Error(t('systemtags', 'Failed to delete tag'))
throw new Error(t('systemtags', 'Failed to delete tag'), { cause: error })
}
}

Expand Down
6 changes: 3 additions & 3 deletions apps/systemtags/src/services/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export async function fetchTagsForFile(fileId: number): Promise<TagWithId[]> {
return parseTags(tags)
} catch (error) {
logger.error(t('systemtags', 'Failed to load tags for file'), { error })
throw new Error(t('systemtags', 'Failed to load tags for file'))
throw new Error(t('systemtags', 'Failed to load tags for file'), { cause: error })
}
}

Expand Down Expand Up @@ -66,7 +66,7 @@ export async function setTagForFile(tag: TagWithId | ServerTagWithId, fileId: nu
})
} catch (error) {
logger.error(t('systemtags', 'Failed to set tag for file'), { error })
throw new Error(t('systemtags', 'Failed to set tag for file'))
throw new Error(t('systemtags', 'Failed to set tag for file'), { cause: error })
}
}

Expand All @@ -82,6 +82,6 @@ export async function deleteTagForFile(tag: TagWithId, fileId: number): Promise<
await davClient.deleteFile(path)
} catch (error) {
logger.error(t('systemtags', 'Failed to delete tag for file'), { error })
throw new Error(t('systemtags', 'Failed to delete tag for file'))
throw new Error(t('systemtags', 'Failed to delete tag for file'), { cause: error })
}
}
14 changes: 7 additions & 7 deletions build/eslint-baseline-legacy.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"apps/files/src/components/FilesNavigationItem.vue": {
"@nextcloud/vue/no-deprecated-props": {
"apps/files/src/components/FilesNavigationListItem.vue": {
"@nextcloud/no-deprecated-library-props": {
"count": 1
}
},
"apps/files/src/components/TransferOwnershipDialogue.vue": {
"@nextcloud/vue/no-deprecated-props": {
"@nextcloud/no-deprecated-library-props": {
"count": 1
}
},
Expand All @@ -15,7 +15,7 @@
}
},
"apps/files_sharing/src/components/SharingInput.vue": {
"@nextcloud/vue/no-deprecated-props": {
"@nextcloud/no-deprecated-library-props": {
"count": 1
}
},
Expand All @@ -30,20 +30,20 @@
}
},
"apps/settings/src/components/GroupListItem.vue": {
"@nextcloud/vue/no-deprecated-props": {
"@nextcloud/no-deprecated-library-props": {
"count": 1
}
},
"apps/settings/src/components/Users/NewUserDialog.vue": {
"@nextcloud/vue/no-deprecated-props": {
"@nextcloud/no-deprecated-library-props": {
"count": 1
},
"vue/no-mutating-props": {
"count": 17
}
},
"apps/settings/src/views/UserManagementNavigation.vue": {
"@nextcloud/vue/no-deprecated-props": {
"@nextcloud/no-deprecated-library-props": {
"count": 4
}
},
Expand Down
2 changes: 1 addition & 1 deletion core/src/OC/dialogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ const Dialogs = {
for (let j = 0; j < H2; j++) {
for (let i = 0; i < W2; i++) {
const x2 = (i + j * W2) * 4
let weight = 0
let weight
let weights = 0
let weights_alpha = 0
let gx_r = 0
Expand Down
3 changes: 1 addition & 2 deletions core/src/OC/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ export default {
}

const s = string.toLowerCase().trim()
let bytes = null

const bytesArray = {
b: 1,
k: 1024,
Expand All @@ -80,6 +78,7 @@ export default {
p: 1024 * 1024 * 1024 * 1024 * 1024,
}

let bytes
const matches = s.match(/^[\s+]?([0-9]*)(\.([0-9]+))?( +)?([kmgtp]?b?)$/i)
if (matches !== null) {
bytes = parseFloat(s)
Expand Down
18 changes: 9 additions & 9 deletions core/src/globals.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/**
/* eslint-disable @nextcloud/no-deprecated-globals */
/*!
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

/* eslint-disable @nextcloud/no-deprecations */
// END TODO
import Backbone from 'backbone'
import ClipboardJS from 'clipboard'
import { dav } from 'davclient.js'
Expand Down Expand Up @@ -43,9 +42,9 @@ function warnIfNotTesting() {
* Mark a function as deprecated and automatically
* warn if used!
*
* @param {Function} func the library to deprecate
* @param {string} funcName the name of the library
* @param {number} version the version this gets removed
* @param {Function} func - The library to deprecate
* @param {string} funcName - The name of the library
* @param {number} version - The version this gets removed
* @return {Function}
*/
function deprecate(func, funcName, version) {
Expand All @@ -59,10 +58,11 @@ function deprecate(func, funcName, version) {
}

/**
* Mark a global variable as deprecated and automatically
*
* @param global
* @param cb
* @param msg
* @param global - the global variable to deprecate, can be a string or an array of strings
* @param cb - a callback that returns the value of the global variable, this is needed to avoid circular dependencies
* @param msg - an optional message to show in the warning, e.g. to suggest an alternative, this will be appended to the default warning message
*/
function setDeprecatedProp(global, cb, msg) {
(Array.isArray(global) ? global : [global]).forEach((global) => {
Expand Down
5 changes: 0 additions & 5 deletions core/src/jquery/ocdialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,6 @@ $.widget('oc.ocdialog', {
}

const self = this
let contentDiv = $('#content')
if (contentDiv.length === 0) {
// nextcloud-vue compatibility
contentDiv = $('.content')
}
this.overlay = $('<div>')
.addClass('oc-dialog-dim')
.insertBefore(this.$dialog)
Expand Down
Loading
Loading