镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Request to Include "Rename" and "Move" Events in Webhook Notifications #50938

Description

@JLashN

I've noticed that while the Nextcloud webhook currently emits events for actions such as file creation, update, and deletion, it does not provide distinct events for file renaming or moving. This limitation poses challenges for integrations and applications that rely on webhooks to accurately track file changes and maintain synchronization.

Questions:

  • Reasoning: Is there a specific design or technical reason for not including dedicated events for renaming and moving files?
  • Future Plans: Are there any plans to add support for "rename" and "move" events in upcoming releases?
  • Workaround: In the meantime, is there a recommended approach or workaround to detect when files are renamed or moved via webhooks?

I believe that adding these events would improve the reliability of third-party integrations that depend on comprehensive file event notifications. Any insights or updates on this feature would be greatly appreciated.

Thank you for your time and consideration!

Activity

  1. joshtrichards commented on Feb 25, 2025

    @joshtrichards
    Member

    it does not provide distinct events for file renaming

    I don't see any reason why not. It should already in theory:

    https://docs.nextcloud.com/server/latest/admin_manual/webhook_listeners/index.html#nextcloud-webhook-events

    OCP\Files\Events\Node\NodeRenamedEvent
    OCP\Files\Events\Node\BeforeNodeRenamedEvent

  2. pierophp commented on Mar 5, 2025

    @pierophp

    @joshtrichards

    I'm running Nextcloud 31 and both the OCP\Files\Events\Node\NodeRenamedEvent and OCP\Files\Events\Node\BeforeNodeRenamedEvent are not working:

    Image

    Instead, only the OCP\Files\Events\Node\NodeWrittenEvent and OCP\Files\Events\Node\NodeDeletedEvent are being triggered:

    Image

    Image

  3. pierophp commented on Mar 5, 2025

    @pierophp

    I found a error on log:

    {
      "reqId": "rNOSVLdjGIIt9q7l13gt",
      "level": 3,
      "time": "2025-03-05T13:50:15+00:00",
      "remoteAddr": "172.30.0.1",
      "user": "docker-user2",
      "app": "no app in context",
      "method": "MOVE",
      "url": "/remote.php/dav/files/docker-user2/LFF/1662.jpg",
      "message": "Exception thrown: OCP\\Files\\NotFoundException",
      "userAgent": "Mozilla/5.0 (Windows) mirall/3.15.3 (build 20250107) (Nextcloud, windows-10.0.26100 ClientArchitecture: x86_64 OsArchitecture: x86_64)",
      "version": "31.0.0.18",
      "exception": {
        "Exception": "OCP\\Files\\NotFoundException",
        "Message": "",
        "Code": 0,
        "Trace": [
          {
            "file": "/var/www/html/lib/public/EventDispatcher/JsonSerializer.php",
            "line": 28,
            "function": "getId",
            "class": "OC\\Files\\Node\\NonExistingFile",
            "type": "->",
            "args": []
          },
          {
            "file": "/var/www/html/lib/public/Files/Events/Node/AbstractNodesEvent.php",
            "line": 49,
            "function": "serializeFileInfo",
            "class": "OCP\\EventDispatcher\\JsonSerializer",
            "type": "::",
            "args": [{ "__class__": "OC\\Files\\Node\\NonExistingFile" }]
          },
          {
            "file": "/var/www/html/apps/webhook_listeners/lib/Listener/WebhooksEventListener.php",
            "line": 62,
            "function": "getWebhookSerializable",
            "class": "OCP\\Files\\Events\\Node\\AbstractNodesEvent",
            "type": "->",
            "args": []
          },
          {
            "file": "/var/www/html/apps/webhook_listeners/lib/Listener/WebhooksEventListener.php",
            "line": 43,
            "function": "serializeEvent",
            "class": "OCA\\WebhookListeners\\Listener\\WebhooksEventListener",
            "type": "->",
            "args": [
              { "__class__": "OCP\\Files\\Events\\Node\\BeforeNodeRenamedEvent" }
            ]
          },
          {
            "file": "/var/www/html/lib/private/EventDispatcher/ServiceEventListener.php",
            "line": 68,
            "function": "handle",
            "class": "OCA\\WebhookListeners\\Listener\\WebhooksEventListener",
            "type": "->",
            "args": [
              { "__class__": "OCP\\Files\\Events\\Node\\BeforeNodeRenamedEvent" }
            ]
          },
          {
            "file": "/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php",
            "line": 220,
            "function": "__invoke",
            "class": "OC\\EventDispatcher\\ServiceEventListener",
            "type": "->",
            "args": [
              { "__class__": "OCP\\Files\\Events\\Node\\BeforeNodeRenamedEvent" },
              "OCP\\Files\\Events\\Node\\BeforeNodeRenamedEvent",
              {
                "__class__": "Symfony\\Component\\EventDispatcher\\EventDispatcher"
              }
            ]
          },
          {
            "file": "/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php",
            "line": 56,
            "function": "callListeners",
            "class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
            "type": "->",
            "args": [
              [
                { "__class__": "Closure" },
                { "__class__": "Closure" },
                { "__class__": "Closure" },
                { "__class__": "Closure" },
                { "__class__": "Closure" }
              ],
              "OCP\\Files\\Events\\Node\\BeforeNodeRenamedEvent",
              { "__class__": "OCP\\Files\\Events\\Node\\BeforeNodeRenamedEvent" }
            ]
          },
          {
            "file": "/var/www/html/lib/private/EventDispatcher/EventDispatcher.php",
            "line": 67,
            "function": "dispatch",
            "class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
            "type": "->",
            "args": [
              { "__class__": "OCP\\Files\\Events\\Node\\BeforeNodeRenamedEvent" },
              "OCP\\Files\\Events\\Node\\BeforeNodeRenamedEvent"
            ]
          },
          {
            "file": "/var/www/html/lib/private/EventDispatcher/EventDispatcher.php",
            "line": 79,
            "function": "dispatch",
            "class": "OC\\EventDispatcher\\EventDispatcher",
            "type": "->",
            "args": [
              "OCP\\Files\\Events\\Node\\BeforeNodeRenamedEvent",
              { "__class__": "OCP\\Files\\Events\\Node\\BeforeNodeRenamedEvent" }
            ]
          },
          {
            "file": "/var/www/html/lib/private/Files/Node/HookConnector.php",
            "line": 155,
            "function": "dispatchTyped",
            "class": "OC\\EventDispatcher\\EventDispatcher",
            "type": "->",
            "args": [
              { "__class__": "OCP\\Files\\Events\\Node\\BeforeNodeRenamedEvent" }
            ]
          },
          {
            "file": "/var/www/html/lib/private/legacy/OC_Hook.php",
            "line": 85,
            "function": "rename",
            "class": "OC\\Files\\Node\\HookConnector",
            "type": "->",
            "args": [
              {
                "oldpath": "/LFF/1662.jpg",
                "newpath": "/LFF/1663.jpg",
                "run": true
              }
            ]
          },
          {
            "file": "/var/www/html/lib/private/Files/View.php",
            "line": 755,
            "function": "emit",
            "class": "OC_Hook",
            "type": "::",
            "args": [
              "OC_Filesystem",
              "rename",
              {
                "oldpath": "/LFF/1662.jpg",
                "newpath": "/LFF/1663.jpg",
                "run": true
              }
            ]
          },
          {
            "file": "/var/www/html/apps/dav/lib/Connector/Sabre/Node.php",
            "line": 133,
            "function": "rename",
            "class": "OC\\Files\\View",
            "type": "->",
            "args": ["/LFF/1662.jpg", "/LFF/1663.jpg"]
          },
          {
            "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Tree.php",
            "line": 171,
            "function": "setName",
            "class": "OCA\\DAV\\Connector\\Sabre\\Node",
            "type": "->",
            "args": ["1663.jpg"]
          },
          {
            "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php",
            "line": 612,
            "function": "move",
            "class": "Sabre\\DAV\\Tree",
            "type": "->",
            "args": [
              "files/docker-user2/LFF/1662.jpg",
              "files/docker-user2/LFF/1663.jpg"
            ]
          },
          {
            "file": "/var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php",
            "line": 89,
            "function": "httpMove",
            "class": "Sabre\\DAV\\CorePlugin",
            "type": "->",
            "args": [
              { "__class__": "Sabre\\HTTP\\Request" },
              { "__class__": "Sabre\\HTTP\\Response" }
            ]
          },
          {
            "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
            "line": 472,
            "function": "emit",
            "class": "Sabre\\DAV\\Server",
            "type": "->",
            "args": [
              "method:MOVE",
              [
                { "__class__": "Sabre\\HTTP\\Request" },
                { "__class__": "Sabre\\HTTP\\Response" }
              ]
            ]
          },
          {
            "file": "/var/www/html/apps/dav/lib/Connector/Sabre/Server.php",
            "line": 49,
            "function": "invokeMethod",
            "class": "Sabre\\DAV\\Server",
            "type": "->",
            "args": [
              { "__class__": "Sabre\\HTTP\\Request" },
              { "__class__": "Sabre\\HTTP\\Response" }
            ]
          },
          {
            "file": "/var/www/html/apps/dav/lib/Server.php",
            "line": 397,
            "function": "start",
            "class": "OCA\\DAV\\Connector\\Sabre\\Server",
            "type": "->",
            "args": []
          },
          {
            "file": "/var/www/html/apps/dav/appinfo/v2/remote.php",
            "line": 21,
            "function": "exec",
            "class": "OCA\\DAV\\Server",
            "type": "->",
            "args": []
          },
          {
            "file": "/var/www/html/remote.php",
            "line": 145,
            "args": ["/var/www/html/apps/dav/appinfo/v2/remote.php"],
            "function": "require_once"
          }
        ],
        "File": "/var/www/html/lib/private/Files/Node/NonExistingFile.php",
        "Line": 37,
        "message": "",
        "exception": {},
        "CustomMessage": "Exception thrown: OCP\\Files\\NotFoundException"
      }
    }
    
  4. added and removed
    0. Needs triagePending check for reproducibility or if it fits our roadmap
    on Jun 23, 2025
  5. moved this from To triage to In progress in 🧑‍🤝‍🧑 Community triageon Jun 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions