nextcloud/viewer

[Bug]: *"View" action failed*, continues to view file

ChristophWurst opened this issue · 6 comments

⚠️ This issue respects the following points: ⚠️

Bug description

1 2
Bildschirmfoto vom 2023-11-15 16-14-17 Bildschirmfoto vom 2023-11-15 16-14-20

Steps to reproduce

  1. Open a directory containing a BMP image
  2. Open the file's action menu
  3. Click View

Expected behavior

No error, or error and no image.

Installation method

None

Nextcloud Server version

28

Operating system

None

PHP engine version

None

Web server

None

Database engine version

None

Is this bug present after an update or on a fresh install?

None

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

No response

List of activated Apps

No response

Nextcloud Signing status

No response

Nextcloud Logs

No response

Additional info

No response

It also happens with PDF and JPG.

viewer/src/views/Viewer.vue

Lines 922 to 937 in c5a7fb2

registerFileAction(new FileAction({
id: 'view',
displayName() {
return t('viewer', 'View')
},
iconSvgInline: () => EyeSvg,
default: DefaultType.DEFAULT,
enabled: (nodes) => {
// Faster to check if at least one node doesn't match the requirements
return !nodes.some(node => (
(node.permissions & Permission.READ) === 0
|| !this.Viewer.mimetypes.includes(node.mime)
))
},
exec: filesActionHandler,
}))
actions must be the one registered by Viewer.

The error "{displayName}" action failed is created by Files

https://github.com/nextcloud/server/blob/ce6e3a3a01ee33fb010382cb33f527dcb8989544/apps/files/src/components/FileEntry/FileEntryActions.vue#L282-L293

the viewer action

returns undefined. Therefore it is assumed that the action ran into an error.

If it returns true there would be a success toast.
If it returns null the success and error toasts could be hidden.

cc @juliushaertl @max-nextcloud because this probably comes from the migration in #1878

Just from code reading I guess the return value of the action exec function of viewer is undefined not null.

exec: filesActionHandler,

// replace potential leading double slashes
const path = `${node.dirname}/${node.basename}`.replace(/^\/\//, '/')
const oldRoute = [
window.OCP.Files.Router.name,
window.OCP.Files.Router.params,
window.OCP.Files.Router.query,
true,
]
const onClose = () => window.OCP.Files.Router.goToRoute(...oldRoute)
pushToHistory(node, view, dir)
OCA.Viewer.open({ path, onPrev: pushToHistory, onNext: pushToHistory, onClose })

https://github.com/nextcloud/server/blob/c2c5994d7069464b9e69a54ce2c660a1a340c711/apps/files/src/components/FileEntry/FileEntryActions.vue#L285

I totally missed your earlier replies where you concluded the same 🙈

But good we are on the same page 🤝