Skip to content
Draft
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 appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
<category>customization</category>
<bugs>https://github.com/nextmcloud/nmcsharing/issues</bugs>
<dependencies>
<nextcloud min-version="30" max-version="34"/>
<nextcloud min-version="30" max-version="35"/>
</dependencies>
</info>
2 changes: 1 addition & 1 deletion src/components/SharingEntryLink.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<template>
<li
:class="{ 'sharing-entry--share': share }"
class="sharing-entry sharing-entry__link">

Check warning on line 4 in src/components/SharingEntryLink.vue

View workflow job for this annotation

GitHub Actions / eslint

Expected 1 line break after opening tag (`<li>`), but 2 line breaks found

<div
class="sharing-entry__desc"
@click.prevent="toggleQuickShareSelect">

Check warning on line 8 in src/components/SharingEntryLink.vue

View workflow job for this annotation

GitHub Actions / eslint

Expected 1 line break after opening tag (`<div>`), but 2 line breaks found

<span
class="sharing-entry__title"
Expand Down Expand Up @@ -63,7 +63,7 @@
:aria-label="actionsTooltip"
menu-align="right"
:open.sync="open"
:force-menu="true">

Check warning on line 66 in src/components/SharingEntryLink.vue

View workflow job for this annotation

GitHub Actions / eslint

Expected 1 line break after opening tag (`<NcActions>`), but 2 line breaks found

<NcActionText
v-if="errors.pending"
Expand Down Expand Up @@ -420,11 +420,11 @@
return null
}

const expirationTime = moment(

Check warning on line 423 in src/components/SharingEntryLink.vue

View workflow job for this annotation

GitHub Actions / eslint

The global property or function moment was deprecated in Nextcloud 18.0.0
this.share.passwordExpirationTime,
)

if (expirationTime.diff(moment()) < 0) {

Check warning on line 427 in src/components/SharingEntryLink.vue

View workflow job for this annotation

GitHub Actions / eslint

The global property or function moment was deprecated in Nextcloud 18.0.0
return false
}

Expand Down Expand Up @@ -644,7 +644,7 @@
if (!this.checkShare(this.share)) {
this.open = true

OC.Notification.showTemporary(
showError(
t(
'files_sharing',
'Error, please enter proper password and/or expiration date',
Expand Down Expand Up @@ -701,7 +701,7 @@
* Push a new link share to the server.
*
* @param {Share} share New share
* @param {boolean} [update=false] Update an existing local share

Check warning on line 704 in src/components/SharingEntryLink.vue

View workflow job for this annotation

GitHub Actions / eslint

Defaults are not permitted on @PARAM
* @return {Promise<boolean>}
*/
async pushNewLinkShare(share, update = false) {
Expand Down
41 changes: 40 additions & 1 deletion src/services/FileInfoService.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,44 @@
import { getShareAttributes } from '../utils/ShareAttributes.js'

/**
* Same normalisation as the legacy OC.Files.FileInfo, which Nextcloud 34 removed.
*
* @param {object} data raw file info values
* @return {object} FileInfo
*/
function createLegacyFileInfo(data) {
const fileInfo = {
icon: null,
hasPreview: true,
shareAttributes: [],
quotaAvailableBytes: -1,
}

for (const [key, value] of Object.entries(data)) {
if (typeof value !== 'function') {
fileInfo[key] = value
}
}

if (fileInfo.id !== undefined) {
fileInfo.id = parseInt(data.id, 10)
}

fileInfo.path = data.path || ''

if (fileInfo.type === 'dir') {
fileInfo.mimetype = 'httpd/unix-directory'
} else {
fileInfo.mimetype = fileInfo.mimetype || 'application/octet-stream'
}

if (!fileInfo.type) {
fileInfo.type = fileInfo.mimetype === 'httpd/unix-directory' ? 'dir' : 'file'
}

return fileInfo
}

/**
* Convert a Nextcloud FileNode into the legacy FileInfo shape
* expected by the sharing components.
Expand Down Expand Up @@ -67,7 +106,7 @@ export default function FileInfo(node) {
}

const fileInfo =
new OC.Files.FileInfo(rawFileInfo)
createLegacyFileInfo(rawFileInfo)

/*
* Compatibility helpers required by the existing
Expand Down
Loading