Skip to content

UploadReady event sets opaque_id to space_id instead of file node ID #12056

@paul43210

Description

@paul43210

Bug

The UploadReady event always sets FileRef.ResourceId.OpaqueId to the space ID instead of the file's actual node ID. Every upload is affected.

Location (reva)

Two locations in decomposedfs construct a Reference with OpaqueId: session.SpaceID() instead of OpaqueId: session.NodeID():

1. pkg/storage/utils/decomposedfs/decomposedfs.go (~line 392):

FileRef: &provider.Reference{
    ResourceId: &provider.ResourceId{
        StorageId: session.ProviderID(),
        SpaceId:   session.SpaceID(),
        OpaqueId:  session.SpaceID(),  // BUG: should be session.NodeID()
    },
    Path: utils.MakeRelativePath(filepath.Join(session.Dir(), session.Filename())),
},

2. pkg/storage/utils/decomposedfs/upload.go (~line 103):

uploadRef := &provider.Reference{
    ResourceId: &provider.ResourceId{
        StorageId: session.ProviderID(),
        SpaceId:   session.SpaceID(),
        OpaqueId:  session.SpaceID(),  // BUG: should be session.NodeID()
    },
    Path: utils.MakeRelativePath(filepath.Join(session.Dir(), session.Filename())),
}

The correct value is already used in the FinishUpload() return value in the same file:

ri := &provider.ResourceInfo{
    Id: &provider.ResourceId{
        StorageId: session.ProviderID(),
        SpaceId:   session.SpaceID(),
        OpaqueId:  session.NodeID(),  // CORRECT
    },
}

Evidence

From a custom NATS consumer, every UploadReady event has opaque_id == space_id:

resource_id.opaque_id = "adbf7f74-899e-4ff4-a8f5-56cf4a82f892"
resource_id.space_id  = "adbf7f74-899e-4ff4-a8f5-56cf4a82f892"

The opaque_id should be the file's unique node ID (e.g., 82e37e46-d840-49e0-b87a-c6eda0f4caba).

Current impact

Low — all four current consumers in oCIS (search, postprocessing, activitylog, clientlog) either ignore the OpaqueId, extract only the SpaceId, or resolve the file via the Path field (which is correct). The bug is latent but will break any new consumer that relies on ResourceId.OpaqueId to identify the uploaded file.

Fix

Change session.SpaceID() to session.NodeID() for the OpaqueId field in both locations in the reva codebase.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions