nextcloud / nextcloud/workflow_script

Workflow script called multiple times

Offen
#43 0 Kommentare 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

0. Needs triage bug
Vorherrschende Sprache
PHP
Sterne
89
Forks
19
Ø Merge
6 Std. 38 Min.
Gemergte PRs (30 T.)
3

Beschreibung

Steps to reproduce

Context: I'm wanting to create a script to automatically convert videos. I wasn't seeing my script get triggered so I added 2 workflows for testing and had the script just log information when I noticed odd behavior. This is what I found.

  1. Install a vanilla nextcloud/vm instance of NextCloud
  2. Enable Workflow
  3. Add a workflow script on file upload (i.e. creation):
    • When: File Created
    • and User group membership is member of Users
    • Run script: nc_video_converter upload %e %n %f
      4.Add a workflow script on tag:
    • When: Tag assigned
    • and User group membership is member of Users
    • Run script: nc_video_converter tag %e %n %f
  4. Create a nc_video_converter script on the server
    • sudo vim /usr/bin/nc_video_converter
      #!/bin/bash
      echo "Running converter..." >> /var/log/nc_video_converter
      echo "$@" >> /var/log/nc_video_converter
      
    • sudo chmod +x /usr/bin/nc_video_converter
    • (not sure if this is needed?) sudo chown www-data:www-data /usr/bin/nc_video_converter
  5. Create a user assigned to the Users group
  6. Login as that user and upload a file
  7. Notice the /var/log/nc_video_converter file shows:
    Running converter...
    tag OCP\SystemTag\ISystemTagObjectMapper::assignTags /myusername/files/Screen Shot 2020-04-02 at 4.02.43 PM.png /tmp/oc_tmp_6Z7GGl-.png
    Running converter...
    upload OCP\SystemTag\ISystemTagObjectMapper::assignTags /myusername/files/Screen Shot 2020-04-02 at 4.02.43 PM.png /tmp/oc_tmp_XjOYL4-.png
    
  8. Add a tag to a file
  9. Notice the /var/log/nc_video_converter file shows:
    Running converter...
    tag \OCP\Files::postCreate /myusername/files/Screen Shot 2020-04-02 at 4.02.33 PM.png /tmp/oc_tmp_Jd9L2p-.png
    Running converter...
    upload \OCP\Files::postCreate /myusername/files/Screen Shot 2020-04-02 at 4.02.33 PM.png /tmp/oc_tmp_5evyop-.png
    
Expected behaviour

I expect that when I upload a file that only the workflow for the file upload would be triggered.

I expect that when I tag a file that only the workflow for the tag would be triggered.

Actual behaviour

When I upload a file both the file upload AND the tag workflows were triggered. Interestingly, though, you can see that both workflows printed the same event name: OCP\SystemTag\ISystemTagObjectMapper::assignTags.

When I tag a file both both workflows were triggered. Interestingly, both workflows printed the same event name \OCP\Files::postCreate.

Workflow Script app

Workflow Script app version: 1.3.1

Server configuration

Operating system: Ubuntu 18.04 LTS (Linux ubuntu-bionic 4.15.0-91-generic)

Web server: Apache

Database: PostgreSQL

PHP version: PHP 7.2.24-0ubuntu0.18.04.3 (cli)

Nextcloud Version: 18.0.3

Where did you install Nextcloud from: github.com/nextcloud/vm using the virtualbox example

Signing status:

No errors have been found.

List of activated apps:

Enabled:
  - accessibility: 1.4.0
  - activity: 2.11.0
  - admin_audit: 1.8.0
  - cloud_federation_api: 1.1.0
  - comments: 1.8.0
  - dav: 1.14.0
  - federatedfilesharing: 1.8.0
  - federation: 1.8.0
  - files: 1.13.1
  - files_pdfviewer: 1.7.0
  - files_rightclick: 0.15.2
  - files_sharing: 1.10.1
  - files_trashbin: 1.8.0
  - files_versions: 1.11.0
  - files_videoplayer: 1.7.0
  - firstrunwizard: 2.7.0
  - logreader: 2.3.0
  - lookup_server_connector: 1.6.0
  - nextcloud_announcements: 1.7.0
  - notifications: 2.6.0
  - oauth2: 1.6.0
  - password_policy: 1.8.0
  - photos: 1.0.0
  - privacy: 1.2.0
  - provisioning_api: 1.8.0
  - recommendations: 0.6.0
  - serverinfo: 1.8.0
  - settings: 1.0.0
  - sharebymail: 1.8.0
  - support: 1.1.0
  - survey_client: 1.6.0
  - systemtags: 1.8.0
  - text: 2.0.0
  - theming: 1.9.0
  - twofactor_backupcodes: 1.7.0
  - updatenotification: 1.8.0
  - video_converter: 0.1.3
  - viewer: 1.2.0
  - workflow_script: 1.3.1
  - workflowengine: 2.0.0
Disabled:
  - encryption
  - files_external
  - user_ldap

Nextcloud configuration:

``` If you have access to your command line run e.g.: sudo -u www-data php occ config:list system from within your Nextcloud installation folder

or

Insert your config.php content here
Make sure to remove all sensitive content such as passwords. (e.g. database password, passwordsalt, secret, smtp password, …)

</details>

**Are you using external storage, if yes which one:** local/smb/sftp/...

**Are you using encryption:** yes/no

### Server log (data/nextcloud.log)
<details>

(not available)


</details>

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, das Problem mit den Apps workflow_script 1.3.1 und workflowengine 2.0.0 unter Verwendung der beiden Workflow-Konfigurationen und des hier beschriebenen Skripts /usr/bin/nc_video_converter zu reproduzieren. Verfolge die gemeldeten OCP-Ereignisnamen für die Dateierstellung und die Tag-Zuweisung; die Aufgabe ist abgeschlossen, wenn das Hochladen und Taggen jeweils nur den passenden Workflow mit dem korrekten Ereignis auslösen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
php
Bereich
backend
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
38/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.